Using date display formats

Applies to

Display formats

Description

A date display format can have two sections. The first section is required. The second section is optional and specifies how to represent NULLs:

date-format;null-format

The following table shows characters that have special meaning in date 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.

Usage

If users specify a two-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:

  • 1/1/85 is interpreted as January 1, 1985

  • 1/1/40 is interpreted as January 1, 2040

Examples

The following table shows how the date Friday, Jan. 30, 2003, displays when different format masks are applied.

Format

Displays

[red]m/d/yy

1/30/03 (in red)

d-mmm-yy

30-Jan-03

dd-mmmm

30-January

mmm-yy

Jan-03

dddd, mmm d, yyyy

Friday, Jan 30, 2003