Display Formats for Date and Time Data

Display formats for date and time data typically apply a pattern to the data. For example, you can indicate whether you want a short form of the date or a long form, and whether to use space, slashes, or dashes as separators.

If you want to automatically apply the correct names of months and days, and the correct format for a specific locale, you can set the NLS locale using the $NLS_LOCALE assignment setting or $nlslocale ProcScript function to a specific locale. You can override the behavior specified by NLS locale by setting $NLS_FORMAT or $nlsformat. For more information, see Parsing and Displaying Date and Time Data.

Note: In dynamic server pages, display formats may not be applied as expected, depending on the data type of the field, the HTML control to which the field's widget resolves, and the browser used. For more information, see Display Formats for Date and Time in Dynamic Server Pages.

Date

Date Display Formats
Display format Explanation
d Day number in one or two digits.
dd Day number in two digits.
zd Day number in two digits or one space and one digit.
aa Two-letter abbreviation for day name; lowercase.
AA Two-letter abbreviation for day name; uppercase.
Aa Two-letter abbreviation for day name; initial letter is capitalized.
aa* Full day name; lowercase.
AA* Full day name; uppercase.
Aa* Full day name; initial letter is capitalized.
aaa Three-letter abbreviation for day name; lowercase.
AAA Three-letter abbreviation for day name; uppercase.
Aaa Three-letter abbreviation for day name; initial letter is capitalized.
m Month number in one or two digits.
mm Month number in two digits.
zm Month number in two digits or one space and one digit.
mmm Three-letter abbreviation for month; lowercase.
MMM Three-letter abbreviation for month; uppercase.
Mmm Three-letter abbreviation for month; initial letter is capitalized.
mmm* Full month name; lowercase.
MMM* Full month name; uppercase.
Mmm* Full month name; initial letter is capitalized.
w Week number in one or two digits.
ww Week number in two digits.
zw Week number in two digits or one space and one digit.
yy Calendar year in two digits.
yy+nnn

yy-nnn

Calendar year in two digits, plus or minus number for automatic era correction.
yyyy Calendar year in four digits.
yyyy+nnn

yyyy-nnn

Calendar year, plus or minus number for automatic era correction.
xx Fiscal year in two digits. Not supported in DSPs.
xx+nnn

xx-nnn

Fiscal year in two digits, plus or minus number for automatic era correction. Not supported in DSPs.
xxxx Fiscal year in four digits. Not supported in DSPs.
xxxx+nnn

xxxx-nnn

Fiscal year in four digits, plus or minus number for automatic era correction.Not supported in DSPs.
L code Number of days, months or years as a linear value, using one of the above codes. Not supported in DSPs.

Date Display Format Examples

Date and Linear Date Fields
Display Format Displayed (1) Displayed (2)
Mmm* d, yyyy March 16, 1995 June 2, 2010
AA, MMM d WED, MAR 16 THU, JUN 2
dd/mm/yy 16/03/95 02/06/10
mm/dd/yy 03/16/95 06/02/10
d/m/yy 16/3/95 2/6/10
zd/zm/yy 16/ 3/95 2/ 6/10
dd-mm-yyyy+543 (for Thai era) 1 16-03-2538 02-06-2662

Lzd.yyyy 1

25 December, 1990 359.1990
Ldd.mm.yyyy 1 25 December, 1990 25.12.1990
Ldd.mm.yyyy 1 25 days and 11 months 25.11.0
1Not supported in DSPs.

Time

Time Display Formats
Display format Explanation
h Hours in one or two digits.
hh Hours in two digits.
zh Hours in two digits or one space and one digit.
n Minutes in one or two digits.
nn Minutes in two digits.
zn Minutes in two digits or one space and one digit.
s Seconds in one or two digits.
ss Seconds in two digits.
zs Seconds in two digits or one space and one digit.
lh Number of hours as linear value. Not supported in DSPs.
ln Number of minutes as linear value. Not supported in DSPs.
ls Number of seconds as linear value. Not supported in DSPs.
t ‘Ticks’ (1/100 seconds).

Time Display Format Examples

Time and Linear Fields
Display format Displayed  
hh:nn 16:15 or 09:05  
h:nn 16:15 or 9:05  
hh:nn.ss 16:15.2 or 09:05.0  
h:nn.s 16:15.2 or 9:05.3  
zh:zm.zs 16:15.2 or 9: 5. 3  
Lzzd.zh.zn.zs 1 27 days, 3 hours, 31 minutes 27.3.31.0
Lzzd.zh.zn.zs 1 71 minutes, 29 seconds 0.1.11.29
1Not supported in DSPs.
Combined Date and Time Fields

Display format

Displayed

dd MMM yyyy hh:nn:ss

2 APR 1991 14:15:39

$NLS Display Formats for Date and Time

You can apply a locale-based display format to a date or time field using the $NLS format.

On Windows , if $nlsLocale is set to system:

  • For the date, MEDIUM is mapped to SHORT, and FULL is mapped to LONG
  • For the time, all are mapped to SHORT

In dynamic server pages, $NLS formats can be applied, but text will be in English.

$NLS Display Formats for Date and Time
Display Format Shorthand Syntax Locale Result
$NLS(SHORT) DIS($NLS(SHORT))   SHORT format for the data type and locale
$NLS(SHORT, DATE) DIS($NLS(SHORT, DATE)) en_US 2/23/10
en_GB1 23/02/2010
fr_CA1 10-02-23
$NLS(SHORT, TIME) DIS($NLS(SHORT, TIME)) en_US 9:13 AM
en_GB1 09:13
fr_CA1 09:13
$NLS(SHORT, DATIM) DIS($NLS(SHORT, DATIM)) en_US 2/23/10 09:13
en_GB1 23/02/2010 09:13
fr_CA1 10-02-23 09:13
$NLS(MEDIUM) DIS($NLS(MEDIUM))   MEDIUM format for the data type and locale
$NLS(MEDIUM, DATE) DIS($NLS(MEDIUM, DATE)) en_US Feb 23, 2010
en_GB1 23 Feb 2010
fr_CA1 2010-02-23
$NLS(MEDIUM, TIME) DIS($NLS(MEDIUM, TIME)) en_US 9:13:33 AM
en_GB1 09:13:33
fr_CA1 09:13:33
$NLS(MEDIUM, DATIM) DIS($NLS(MEDIUM, DATIM)) en_US Feb 23, 2010
en_GB1 23 Feb 2010 09:13:33
fr_CA1 2010-02-23 09:13:33
$NLS(LONG) DIS($NLS(LONG))   LONG format for the data type and locale
$NLS(LONG, DATE) DIS($NLS(LONG, DATE)) en_US February 23, 2010
en_GB1 23 February 2010
fr_CA1 23 février 2010
$NLS(LONG, TIME) DIS($NLS(LONG, TIME)) en_US 9:13:33 AM
en_UK1 09:13:33
fr_CA1 09:13:33
$NLS(LONG, DATIM) DIS($NLS(LONG, DATIM)) en_US February 23, 2010 9:13:33 AM
en_GB1 23 February 2010 09:13:33
fr_CA1 23 février 2010 09:13:33
$NLS(FULL) DIS($NLS(FULL))   FULL format for the data type and locale
$NLS(FULL, DATE) DIS($NLS(FULL, DATE)) en_US Tuesday, February 23, 2010
en_GB1 Tuesday, 23 February 2010
fr_CA1 mardi 23 février 2010
$NLS(FULL, TIME) DIS($NLS(FULL, TIME)) en_US 9:13:33 AM
en_GB1 09:13:33
fr_CA1 09:13:33
$NLS(FULL, DATIM) DIS($NLS(FULL, DATIM)) en_US Tuesday, February 23, 2010 9:13:33 AM
en_GB1 Tuesday, 23 February 2010 09:13:33
fr_CA1 mardi 23 février 2010 09:13:33
$NLS(FormatPattern) DIS($NLS(FormatPattern))

For example:

DIS($NLS("Aa*, dd-Mmm*-yyyy"))

en_US Tuesday, 23-February-2010
en_GB1 Tuesday, 23-February-2010
fr_CA1 Mardi, 23-Février-2010
1Locale is ignored and English text is used unless $webinfo("locale") has been set.

Japanese Era Date Formats

The traditional dating system in Japan as based on the reigns of the emperors. Uniface provides language setups for modern Japanese eras in libmsg.usys.xml.

Modern Japanese Eras
Date Japanese Era (Kanji) Japanese Era (Western)
1868-1912

明治

Meiji
1912-1926

大正

Taishō
1926-1989

昭和

Shōwa
1989-2019

平成

Heisei
2019 to present

令和

Reiwa

To display the Japanese era, set the field layout definition to J or JJ. For example: dis(j-mm-dd) displays 平成 10-08-11

Note:  You must have the Kanji font available on your machine.

Related Topics