Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns an integer that represents the specified datepart of the specified date.
Syntax
DATEPART ( datepart , date )
Arguments
datepart
Is the part of date (a date or time value) for which an integer will be returned. The following table lists all valid datepart arguments.
datepart | Abbreviations |
---|---|
year | yy, yyyy |
quarter | qq, q |
month | mm, m |
dayofyear | dy, y |
day | dd, d |
week | wk, ww |
weekday | dw, w |
hour | hh |
minute | mi, n |
second | ss, s |
millisecond | ms |
microsecond | mcs |
date
Is an expression that can be resolved to a datetime. date can be an expression, column expression, or string literal.
Return Types
bigint
Examples
SELECT DATEPART (weekday, EntryTime)
FROM Input TIMESTAMP BY EntryTime
WHERE Toll > 5