Date display formats

Date display formats can have two sections. The first is required and contains the format for dates; the second is optional and specifies how to represent NULLs:

date-format;null-format

Special characters

Table 22-4 shows characters that have special meaning in date display formats.

Table 22-4: Characters with special meaning in data display formats

Character

Meaning

Example

d

Day number with no leading zero

9

dd

Day number with leading zero if appropriate

09

ddd

Day name abbreviation

Mon

dddd

Day name

Monday

m

Month number with no leading zero

6

mm

Month number with leading zero if appropriate

06

mmm

Month name abbreviation

Jun

mmmm

Month name

June

yy

Two-digit year

97

yyyy

Four-digit year

1997

Colons, slashes, and spaces display as entered in the mask.

NoteAbout 2-digit years If users specify a 2-digit year in a DataWindow object, PowerBuilder assumes the date is the 20th century if the year is greater than or equal to 50. If the year is less than 50, PowerBuilder assumes the 21st century. For example:

Date keywords

You can use the following keywords as date display formats when you want PowerBuilder to determine an appropriate format to use:

The format used is determined by the regional settings for date in the registry. Note that [Date] is not a valid display format.

Examples

Table 22-5 shows how the date Friday, January 30, 1998, displays when different format masks are applied.

Table 22-5: Date display format examples

Format

Displays

[red]m/d/yy

1/30/98 in red

d-mmm-yy

30-Jan-98

dd-mmmm

30-January

mmm-yy

Jan-98

dddd, mmm d, yyyy

Friday, Jan 30, 1998