I am going to continue my series of short articles or tidbits on Transaction SQL date/time functions.
Most, if not all, modern day computer systems collect data which contains dates and times.
Not only is it important to know when a sales order came in, but we should fulfill the request using some type of queue (LIFO). If if was a stack (FIFO) implementation, the first person may never get his order!
I will be exploring functions that return the current system date and time in a defined data type format. Some formats have more precision than others.
Today, I will be investigating the SYSDATETIMEOFFSET() function. This function takes does not take any arguments but returns a datetimeoffset(7) data type.
The example below is a sample call to the function.
1 2 3 4 5 |
-- -- Get system date/time - function 2 -- SELECT SYSDATETIMEOFFSET() AS CURRENT_DT2; |
The output from the test is listed below.
1 2 3 4 5 |
output: CURRENT_DT2 ---------------------------------- 2013-11-26 13:37:24.1311272 -05:00 |
In a nutshell, this function returns the current system date and time in datetimeoffset(7) format.