You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[!INCLUDE tsql] derives all system date and time values from the operating system of the computer on which the instance of [!INCLUDE ssNoVersion] runs.
Higher-precision system date and time functions
Since [!INCLUDE sql2008-md], the [!INCLUDE ssde-md] derives the date and time values through use of the GetSystemTimeAsFileTime() Windows API. The accuracy depends on the computer hardware and version of Windows on which the instance of [!INCLUDE ssNoVersion] runs. This API has a precision fixed at 100 nanoseconds. Use the GetSystemTimeAdjustment() Windows API to determine the accuracy.
The SYSDATETIME function returns a datetime2(7) value containing the date and time of the computer on which the instance of [!INCLUDE ssNoVersion] runs. The returned value doesn't include the time zone offset.
The SYSDATETIMEOFFSET function returns a datetimeoffset(7) value containing the date and time of the computer on which the instance of [!INCLUDE ssNoVersion] runs. The returned value includes the time zone offset.
The SYSUTCDATETIME function returns a datetime2(7) value containing the date and time of the computer on which the instance of [!INCLUDE ssNoVersion] is running. SYSUTCDATETIME returns the date and time values as UTC time (Coordinated Universal Time).
The CURRENT_TIMESTAMP function returns a datetime value containing the date and time of the computer on which the instance of [!INCLUDE ssNoVersion] runs. The returned value doesn't include the time zone offset.
The GETDATE function returns a datetime value containing the date and time of the computer on which the instance of [!INCLUDE ssNoVersion] runs. The returned value doesn't include the time zone offset.
The GETUTCDATE function returns a datetime value containing the date and time of the computer on which the instance of [!INCLUDE ssNoVersion] runs. The GETUTCDATE function returns the date and time values as UTC time (Coordinated Universal Time).
The CURRENT_DATE function returns a date value containing only the date of the computer on which the instance of the [!INCLUDE ssde-md] runs. The returned value doesn't include the time and the time zone offset.
The DATE_BUCKET function returns a value corresponding to the start of each date-time bucket from the timestamp defined by the origin parameter, or the default origin value of 1900-01-01 00:00:00.000 if the origin parameter isn't specified.
The return type depends on the argument supplied for date.
The TODATETIMEOFFSET function transforms a datetime2 value into a datetimeoffset value. TODATETIMEOFFSET interprets the datetime2 value in local time, for the specified time_zone.
datetimeoffset with the fractional precision of the datetime argument
Deterministic
Tip
For more information and recommendations about manipulating time zone information in SQL Server with the datetimeoffset data type, see AT TIME ZONE.
Functions that set or return session format functions
The @@LANGUAGE function returns the name of the language in current used. @@LANGUAGE isn't a date or time function. However, the language setting can affect the output of date functions.
SET LANGUAGE { [ N ] '*language*' } or SET LANGUAGE { *@language_var* }
Sets the language environment for the session and system messages. SET LANGUAGE isn't a date or time function, but the language setting affects the output of date functions.
The sp_helplanguage function returns information about date formats of all supported languages. The language setting affects the output of date functions.
The ISDATE function determines whether a datetime or smalldatetime input expression has a valid date or time value.
int
The ISDATE function is deterministic only used with the CONVERT function, when the CONVERT style parameter is specified, and when style isn't equal to 0, 100, 9, or 109.
The FORMAT function returns a value formatted with the specified format and optional culture. Use the FORMAT function for locale-aware formatting of date/time and number values as strings.
Provides guidelines for portability of databases and database applications that use [!INCLUDE tsql] statements from one language to another, or that support multiple languages.