DATENAME、DATEPART


DATENAME是回傳"string"型態的

SELECT DATENAME(WEEKDAY, '20170101 00:00:00.000')

DATEPART是回傳"int"型態的

SELECT DATEPART(WEEKDAY, '20170101 00:00:00.000')--Sunday(星期日)-->1、Saturday(星期六)-->7,因為每週第一天為星期日

results matching ""

    No results matching ""