Syntax: |
string = TIME
|
The TIME
function can have one argument or no arguments.
If no argument is given, it returns a string which contains the current time with the format
hh:nn:ss
. A format argument can be provided, as shown in the table
below. The seperator used in the format will be used in the output string.
specifier | displays |
h |
Displays the hour as a number without a leading zero (0-23) |
hh |
Displays the hour as a number with a leading zero (00-23) |
n |
Displays the minute as a number without a leading zero (0-59) |
nn |
Displays the minute as a number with a leading zero (00-59) |
s |
Displays the second as a number without a leading zero (0-59) |
ss |
Displays the second as a number with a leading zero (00-59) |
t |
Displays the time in short format (hh:mm am/pm) |
tt |
Displays the time in long format (hh:mm:ss am/pm) |
am/pm |
Uses the 12-hour clock for the preceding h or
hh specifier, and displays am
for any hour before noon, and pm for any hour after noon. The
am/pm specifier can use lower, upper, or mixed case,
and the result is displayed accordingly. |
Examples
function | result |
TIME |
12:14:26 |
TIME('hh::nn::ss am/pm') |
12::14::26 pm |
TIME('t') |
12:14 PM |
TIME('tt') |
12:14:26 PM |