StringTools[FormatTime] - return a string containing a formatted date or time
|
Calling Sequence
|
|
FormatTime( fmt, option )
|
|
Parameters
|
|
fmt
|
-
|
(optional) string
|
option
|
-
|
(optional) integer offset or an equation of the form or of the form offset = integer[4]
|
|
|
|
|
Description
|
|
•
|
The FormatTime(fmt, option) command returns a string containing a formatted date and time. Both the format string fmt and the integer time displacement or equation option are optional. The default format is the ISO 8601 standard default date format, which has the form YYYY-MM-DD, where "Y" denotes a year digit, "M" denotes a digit of the month (01-12), and "D" denotes a digit of the day of the month (01-31). The default time displacement is (the current time).
|
•
|
The following table lists the known conversion specifiers and their meanings.
|
%%
|
the string "%".
|
%a
|
abbreviated weekday name.
|
%A
|
the full weekday name.
|
%b
|
abbreviated month name.
|
%B
|
full month name.
|
%c
|
a standard date and time representation.
|
%C
|
the century number (the year divided by 100 and truncated to an integer in the range 00 - 99).
|
%d
|
the two-digit day of the month number (01-31).
|
%D
|
the date in the form MM/DD/YY.
|
%e
|
the day of the month (1-31).
|
%H
|
the hour in a 24-hour clock (00-23).
|
%I
|
the hour in a 12-hour clock (01-12).
|
%j
|
day number (01 - 366).
|
%k
|
the hour in a 24-hour clock ( 0-23).
|
%l
|
the hour in a 12-hour clock ( 1-12).
|
%m
|
the month number (01 - 12).
|
%M
|
the minute after the hour (00-59).
|
%n
|
a newline character.
|
%p
|
a.m. or p.m.
|
%r
|
time representation for a 12-hour clock (using %p).
|
%R
|
the same as %H:%M.
|
%S
|
seconds after the minute (00 - 61).
|
%t
|
a tab character.
|
%T
|
same as %H:%M:%S.
|
%u
|
weekday as a decimal number (1-7; 1 = Monday).
|
%U
|
week number of the year (00 - 53); Sunday is the first day of week 1.
|
%V
|
The ISO 8601 week number (01 - 53).
|
%w
|
weekday (0-6); 0 = Sunday.
|
%x
|
a standard date representation.
|
%X
|
a standard time representation.
|
%y
|
year within the century (00 - 99).
|
%Y
|
year including the century (YYYY).
|
%Z
|
time zone name or abbreviation, if available.
|
|
|
•
|
Integer offsets passed via the second parameter must be 32-bit integers.
|
|
|
Examples
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
>
|
|
| (6) |
>
|
|
| (7) |
>
|
|
| (8) |
>
|
|
%% - %
%a - Sat
%A - Saturday
%b - Mar
%B - March
%c - Sat Mar 03 22:20:43 2012
%C - 20
%d - 03
%D - 03/03/12
%e - 3
%H - 22
%I - 10
%j - 063
%k - 22
%l - 10
%m - 03
%M - 20
%p - PM
%r - 10:20:43 PM
%R - 22:20
%S - 43
%T - 22:20:43
%u - 6
%U - 09
%V - 09
%w - 6
%x - 03/03/12
%X - 22:20:43
%y - 12
%Y - 2012
%Z - EST
| |
|
|
Download Help Document
Was this information helpful?