Syntax -
DateFormat <variable name> <DateValue> <Windows Format String>
Where:
<variable name> is the user defined name that is assigned to the variable.
<DateValue> is a literal string that represents a valid date or a variable that contains a date that will be manipulated
<Windows Format String> is a literal string.
Description:
This command is used to reformat the <DateValue1> in the desired <Windows Format String> style. The date in the new format is stored as <variable name>. Windows will accept customer or standard patterns.
Custom Patterns:
The following table defines the custom patterns that can be used to construct the <Windows Format String>. Custom patterns are the most common types of date/time formatting. Scroll down further for standard patterns.
If the custom pattern contains space characters or characters enclosed in single quotation marks, the output string will also contain those characters in the position where they occur in the pattern.
Characters not defined as part of a format pattern or as format characters are reproduced literally.
The patterns are case-sensitive; for example, "MM" is recognized, but "mm" is not.
Format Pattern
|
Description
|
d
|
The day of the month. Single-digit days will not have a leading zero.
|
dd
|
The day of the month. Single-digit days will have a leading zero.
|
ddd
|
The abbreviated name of the day of the week, as defined in AbbreviatedDayNames.
|
dddd
|
The full name of the day of the week, as defined in DayNames.
|
M
|
The numeric month. Single-digit months will not have a leading zero.
|
MM
|
The numeric month. Single-digit months will have a leading zero.
|
MMM
|
The abbreviated name of the month, as defined in AbbreviatedMonthNames.
|
MMMM
|
The full name of the month, as defined in MonthNames.
|
y
|
The year without the century. If the year without the century is less than 10, the year is displayed with no leading zero.
|
yy
|
The year without the century. If the year without the century is less than 10, the year is displayed with a leading zero.
|
yyyy
|
The year in four digits, including the century.
|
gg
|
The period or era. This pattern is ignored if the date to be formatted does not have an associated period or era string.
|
h
|
The hour in a 12-hour clock. Single-digit hours will not have a leading zero.
|
hh
|
The hour in a 12-hour clock. Single-digit hours will have a leading zero.
|
H
|
The hour in a 24-hour clock. Single-digit hours will not have a leading zero.
|
HH
|
The hour in a 24-hour clock. Single-digit hours will have a leading zero.
|
m
|
The minute. Single-digit minutes will not have a leading zero.
|
mm
|
The minute. Single-digit minutes will have a leading zero.
|
s
|
The second. Single-digit seconds will not have a leading zero.
|
ss
|
The second. Single-digit seconds will have a leading zero.
|
tt
|
Displays the proper AM or PM as part of the timestamp.
|
Note: The MM must be capitalized otherwise EMUE will assume that the minutes’ portion of the time is to be used, which in most cases will be 0.
Note: For a 24-hour click (military time), valid times include anything between 00:00:00 and 23:59:59.
Sample:
The following statement uses DateFormat to convert a date into the 6 digit format commonly used in SIGNATURE® and INVISION®.
DateFormat NewDate "2/20/2004" "MMddyy"
Standard Patterns:
The following table defines the standard patterns that can be used to construct the <Windows Format String>.
Format Pattern
|
Description
|
Example
|
d
|
Short date pattern
|
2009-06-15T13:45:30 -> 6/15/2009
|
D
|
Long date pattern
|
2009-06-15T13:45:30 -> Monday, June 15, 2009
|
f
|
Full date/time pattern (short time)
|
2009-06-15T13:45:30 -> Monday, June 15, 2009 1:45 PM
|
F
|
Full date/time pattern (long time)
|
2009-06-15T13:45:30 -> Monday, June 15, 2009 1:45:30 PM
|
g
|
General date/time pattern (short time)
|
2009-06-15T13:45:30 -> 6/15/2009 1:45 PM
|
G
|
General date/time pattern (long time)
|
2009-06-15T13:45:30 -> 6/15/2009 1:45:30 PM
|
M, m
|
Month/day pattern
|
2009-06-15T13:45:30 -> June 15
|
O, o
|
Round-trip date/time pattern
|
2009-06-15T13:45:30--> 2009-06-15T13:45:30.0000000-07:00
|
R, r
|
RFC1123 pattern
|
2009-06-15T13:45:30 -> Mon, 15 Jun 2009 20:45:30 GMT
|
s
|
Sortable date/time pattern
|
2009-06-15T13:45:30-> 2009-06-15T13:45:30
|
t
|
Short time pattern
|
2009-06-15T13:45:30 -> 1:45 PM
|
T
|
Long time pattern
|
2009-06-15T13:45:30 -> 1:45:30 PM
|
u
|
Universal sortable date/time pattern
|
2009-06-15T13:45:30 -> 2009-06-15 13:45:30Z
|
U
|
Universal full date/time pattern
|
2009-06-15T13:45:30 -> Monday, June 15, 2009 8:45:30 PM
|
Y, y
|
Year month pattern
|
2009-06-15T13:45:30 -> June, 2009
|
Sample:
The following statement uses DateFormat to convert a today's date into a short date pattern.
DateFormat NewDate &today "d"
|