For functions FORMATTED-CURRENT-DATE , FORMATTED-DATE , FORMATTED-TIME , and FORMATTED-DATETIME , the format literal argument indicates the format of the date or time value that is the result of the function. The result of the function will have the same type as its format literal, which can be alphanumeric, national or UTF-8.
For functions INTEGER-OF-FORMATTED-DATE , SECONDS-FROM-FORMATTED-TIME , and TEST-FORMATTED-DATETIME , the format literal indicates the format of the date or time value specified as the second argument of the function.
The permissible format strings are listed as follows. For a full description of each subfield in the format literals, including a range of permissible values in data associated with the formats, see the Value meanings and limits section.
A value in integer date form is a positive integer that represents the number of days since 31 December, 1600 in the Gregorian calendar. It must be greater than zero and less than or equal to the value of FUNCTION INTEGER-OF-DATE (99991231), which is 3,067,671.
A value in standard date form is an integer of the form YYYYMMDD, calculated using (YYYY * 10,000) + (MM * 100) + DD, where:
A value in Julian date form is an integer of the form YYYYDDD, calculated using (YYYY * 1000) + DDD, where:
A UTC offset value is an integer representation of offset from UTC (Coordinated Universal Time) expressed in minutes. The value must be greater than or equal to -1439 and less than or equal to 1439.
A value in standard numeric time form is a numeric value representing seconds past midnight. The value must be greater than or equal to zero and less than 86,400
For functions FORMATTED-CURRENT-DATE, FORMATTED-DATE, FORMATTED-TIME, and FORMATTED-DATETIME, the format literal argument indicates the format of the date or time value that is the result of the function. The result of the function will have the same type as its format literal, which can be alphanumeric, national or UTF-8.
For functions INTEGER-OF-FORMATTED-DATE, SECONDS-FROM-FORMATTED-TIME, and TEST-FORMATTED-DATETIME, the format literal indicates the format of the date or time value specified as the second argument of the function.
The permissible format strings are listed as follows. For a full description of each subfield in the format literals, including a range of permissible values in data associated with the formats, see Value meanings and limits.
Date formats | Format literals |
---|---|
Basic calendar date | YYYYMMDD |
Extended calendar date | YYYY-MM-DD |
Basic ordinal date | YYYYDDD |
Extended ordinal date | YYYY-DDD |
Basic week date | YYYYWwwD |
Extended week date | YYYY-Www-D |
Integer-seconds time formats | Format literals |
---|---|
Basic local time | hhmmss |
Extended local time | hh:mm:ss |
Basic Coordinated Universal Time (UTC) | hhmmssZ |
Extended UTC time | hh:mm:ssZ |
Basic offset time | hhmmss+hhmm |
Extended offset time | hh:mm:ss+hh:mm |
Fractional-seconds time formats | Format literals |
---|---|
Basic local time | hhmmss.ssss |
Extended local time | hh:mm:ss.ssss |
Basic Coordinated Universal Time (UTC) | hhmmss.ssssZ |
Extended UTC time | hh:mm:ss.ssssZ |
Basic offset time | hhmmss.ssss+hhmm |
Extended offset time | hh:mm:ss.ssss+hh:mm |
You can combine the date and time formats by concatenating them with an uppercase T. This character also appears at the same place in data associated with the format.
When specifying basic date formats, you can only combine them with the basic time formats, and conversely, you can only combine extended date formats with extended time formats. You cannot mix the two types.
The permissible date and time formats have the following meanings and limits:
Format | Meaning and limits |
---|---|
YYYY | Year, 1601-9999 |
MM | Month, 01-12 |
DD | Day of month, 01-{28|29|30|31} dependent on month sub-field |
DDD | Day of year for ordinal date formats, 001-365|366 |
ww | Week of year, 01-53 |
D | Day of week, 1-7 |
W | |
- | |
hh | Hours, 00-23 |
mm | Minutes, 00-59 |
ss | Seconds, 00-59 |
.s | Fractional seconds, always prefixed with '.' then 1-9 's' |
+|-hh:mm | UTC offset hours (extended times only), the offset can be adjusted upward (by a '+' prefix) or downward (by a - prefix).
A prefix of 0 (zero) indicates that an offset of UTC is not available on the system. |
Z | UTC time indicator |