Returns an integer value for the specified part of a date/time value.
Parameter |
Description |
---|---|
date-part |
The date part to be returned. |
date-expression |
The date for which the part is to be returned. The date must contain the date-part field. |
INT
The following statement returns the value 5:
SELECT DATEPART( MONTH, '1987/05/02' ) FROM iq_dummy
SELECT DATEPART(MICROSECOND, '2009-11-10 14:57:52.722001') FROM iq_dummy
SELECT DATEPART(MICROSECOND, '2000/07/07 07:07:07.777777') FROM iq_dummy
SELECT DATEPART(MCS, '2009-11-03 11:10:42.033189') FROM iq_dummy