Syntax | Description | Example |
---|---|---|
CONVERTTIME(dtSource, sSourceZone, sTargetZone) | Converts a date time, that is considered to reside in the source time zone, to an arbitrary target time zone (e.g. changes the time zone of a date time and returns the date time in the target time zone). | |
DATETIME(sDateTime,[sCulture]) | Returns a date time value from a string. The date time is parsed according to the specified culture. If culture is not specified the value is parsed with the current thread culture. Check out the DateTime.TryParse documentation in MSDN for a complete discussion. |
DATETIME("2008-09-15T09:30:41.770") |
DAY(dtDateTime) | Returns the day [1:31] of a date time value. |
DAY(DATETIME("2008-09-15T09:30:41.770")) Returns: 15 |
HOUR(dtDateTime) | Returns the hour [0:23] of a date time value. |
HOUR(DATETIME("2008-09-15T09:30:41.770")) Returns: 9 |
ISDAYLIGHTSAVINGTIME(dtDateTime, [sTimeZone]) | Returns true if the date time is in the specified time zone daylight savings range. | |
LOCALTIMEZONE() | Returns the server local time zone. | |
MILLISECOND(dtDateTime) | Returns the millisecond [0:999] of a date time value. |
MILLISECOND(DATETIME("2008-09-15T09:30:41.770")) Returns: 770 |
MINUTE(dtDateTime) | Returns the minute [0:59] of a date time value. |
MINUTE(DATETIME("2008-09-15T09:30:41.770")) Returns: 30 |
MONTH(dtDateTime) | Returns the month [1:12] of a date time value. |
MONTH(DATETIME("2008-09-15T09:30:41.770")) Returns: 9 |
NOW() | Returns the system current date time. | NOW() Returns: the current date time |
QUARTER(dtDateTime) | Returns the quarter [1:4] of a date time value. |
QUARTER(DATETIME("2008-09-15T09:30:41.770")) |
SECOND(dtDateTime) | Returns the second [0:59] of a date time value. |
SECOND(DATETIME("2008-09-15T09:30:41.770")) |
TOLOCALTIME(dtUTC, [sTimeZone]) | Converts an UTC date time to the respective local date time in the specified time zone. | |
TOUNIVERSALTIME(dtLocal, [sTimeZone]) | Converts a local date time, that resides in the specified time zone, to the respective date time in UTC. | |
UNIVERSALNOW() | Returns the current date time in UTC. | |
UNIVERSALTIMEZONE() | Returns the universal (UTC) time zone. | |
WEEKDAY(dtDateTime) | Returns the week day [0:6] of a date time value. The 0 is Sunday. |
WEEKDAY(DATETIME("2008-09-15T09:30:41.770")) |
WEEK(dtDateTime[,dtStart]) | Returns the current week, since start date in [-N:N] range. If start date is not specified it is considered to be 1st of January of the date time year (e.g measures the current week from the beginning of the year). |
WEEK(DATETIME("2008-09-15T09:30:41.770")) Returns: 37 |
YEAR(dtDateTime) | Returns the year of a date time value. |
YEAR(DATETIME("2008-09-15T09:30:41.770")) Returns: 2008 |
All functions that accept a time zone string, read time zone information from the following key in the registry of the server:
HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones