NLS Date and Time Format

When NLSGetLocaleInfo (type, outstr) returns information about the date and time formats of the current locale, the value returned in outstr can be interpreted according to the following tables. Any text returned within a date and time string that is enclosed within single quotes should be left in the string in its exact form; that is, do not change the text or the location within the string.

Day

The day can be displayed in one of four formats using the letter "d". The table below shows the four variations:

d Day of the month as digits without leading zeros for single-digit days
dd Day of the month as digits with leading zeros for single-digit days
ddd Day of the week as a three-letter abbreviation (SABBREVDAYNAME)
dddd Day of the week as its full name (SDAYNAME)

Month

The month can be displayed in one of four formats using the letter "M". The uppercase "M" distinguishes months from minutes. The table below shows the four variations:

M Month as digits without leading zeros for single-digit months
MM Month as digits with leading zeros for single-digit months
MMM Month as a three-letter abbreviation (SABBREVMONTHNAME)
MMMM Month as its full name (SMONTHNAME)

Year

The year can be displayed in one of three formats using the letter "y". The table below shows the three variations:

y Year represented by only the last digit
yy Year represented by only the last two digits
yyyy Year represented by the full 4 digits

Period/Era

The period/era string is displayed in a single format using the letters "gg".

gg Period/Era string

Time

The time can be displayed in one of many formats using the letter "h" or "H" to denote hours, the letter "m" to denote minutes, the letter "s" to denote seconds and the letter "t" to denote the time marker. The table below shows the numerous variations of the time format. Lowercase "h" denotes the 12 hour clock and uppercase "H" denotes the 24 hour clock. The lowercase "m" distinguishes minutes from months.

h Hours without leading zeros for single-digit hours (12 hour clock)
hh Hours with leading zeros for single-digit hours (12 hour clock)
H Hours without leading zeros for single-digit hours (24 hour clock)
HH Hours with leading zeros for single-digit hours (24 hour clock)
m Minutes without leading zeros for single-digit minutes
mm Minutes with leading zeros for single-digit minutes
s Seconds without leading zeros for single-digit seconds
ss Seconds with leading zeros for single-digit seconds
t One-character time marker string
tt Multicharacter time marker string

Compatibility

CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB

See Also: NLSGetLocale, NLSFormatDate, NLSFormatTime, NLSSetLocale

Example

 USE DFNLS
 INTEGER(4) strlen
 CHARACTER(40) str
 strlen = NLSGetLocaleInfo(NLS$LI_SDAYNAME1, str)
 print *, str    ! prints Monday if language is English
 strlen = NLSGetLocaleInfo(NLS$LI_SDAYNAME2, str)
 print *, str    ! prints Tuesday if language is English