I am going to keep going with 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 CURRENT_TIMESTAMP() function. This function takes does not take any arguments but returns a datetime data type.
The example below is a sample call to the function.
1 2 3 4 5 |
-- -- Get system date/time - function 4 -- SELECT CURRENT_TIMESTAMP AS CURRENT_DT4; |
The output from the test is listed below.
1 2 3 4 5 |
output: CURRENT_DT4 ----------------------- 2013-11-26 13:46:23.950 |
In a nutshell, this function returns the current system date and time in datetime format.