U_FMTDAT
Format a date value into an alpha date string
WSupported on Windows
|
USupported on Unix
|
VSupported on OpenVMS
|
NSupported in Synergy .NET
|
xcall U_FMTDAT(type, date, [year], [month | julian_day], [day], [D_LEFT], [order] & [, separator])
Arguments
type
The code for the type of date format: (n)
Code |
Default display |
Storage format |
---|---|---|
1 |
PP/YY |
YYPP |
2 |
MM/DD/YY |
YYJJJ |
3 |
MM/DD/YY |
YYMMDD |
4 |
PP/YYYY |
YYYYPP |
5 |
MM/DD/YYYY |
YYYYJJJ |
6 |
MM/DD/YYYY |
YYYYMMDD |
date
Returned with the formatted date. (a)
year
(optional) The year of the date or the entire date in storage format. (n)
month | julian_day
(optional) The month of the date if type 1, 3, 4, or 6 is specified. The Julian day if type 2 or 5 is specified. (n)
day
(optional) The day of the date if type is 1, 3, 4, or 6 and if month is passed. Types 2 and 5 ignore day. (n)
D_LEFT
(optional) The left-justification flag. (n)
order
(optional) The code for the date order, applicable for types 2, 3, 5, and 6: (n)
0 = Month, day, year (default)
1 = Day, month, year
2 = Year, month, day
separator
(optional) The separator between parts of the date (e.g., a slash between day, month, and year). (a)
Discussion
U_FMTDAT formats separate date values into an alpha date string.
If type is 2 or 5 (YYJJJ or YYYYJJJ) and you omit year but pass julian_day, U_FMTDAT will use the day passed and default to use the current year. If year is passed but julian_day is omitted, U_FMTDAT assumes year contains the entire date in storage format. If neither argument is passed, U_FMTDAT defaults to use the current system date.
If type is 1, 3, 4, or 6 and if year is not passed, month and day will be ignored and U_FMTDAT will default to use the current system date. (If you omit all three arguments, U_FMTDAT will also default to use the current date.) If year is passed but month is not, day is ignored and year is assumed to be the entire date in storage format.
The returned format for types 2, 3, 5, and 6 is further controlled by the value of order, which determines the order of their date components. The default for order is the value in g_date_order (defined in tkctl.def).
The separator for all format types is loaded from separator. The default for separator is the value in g_date_sep, which is defined in tkctl.def and initialized by U_START to a forward slash (/).
If type is 5 or 6, and the length of date is exactly 8, a two-digit year will be displayed.
See also
The .FIELD qualifiers DATE, NODATE for more information about date processing
Examples
In the following example, the date (returned in date) is left-justified and formatted as DD-MM-YY.
xcall u_fmtdat(2, date, yr, mn, dy, D_LEFT, 1, "–")
In the next example, the date is returned in date. Stor contains the entire date in storage format in the form YYYYJJJ.
xcall u_fmtdat(5, date, stor)