CodeCharge Studio

Date/Time Format

You can set the Format property using the predefined date and time formats or use the custom formats for the Date/Time data type setting.

Setting

Predefined Formats

The following table shows the predefined Format property settings for the Date/Time data type.
Setting Description
GeneralDate This format depends from regional settings.
If the value is a date only, no time is displayed; if the value is a time only, no date is displayed. This setting is a combination of the Short Date and Long Time settings.

Examples: 4/3/93, 05:34:00 PM, and 4/3/93 05:34:00 PM.

LongDate This format depends from regional settings.

Example: Saturday, April 3, 1993.

ShortDate This format depends from regional settings.

Example: 4/3/93.

Warning: The Short Date setting assumes that dates between 1/1/00 and 12/31/29 are twenty-first century dates (that is, the years are assumed to be 2000 to 2029). Dates between 1/1/30 and 12/31/99 are assumed to be twentieth century dates (that is, the years are assumed to be 1930 to 1999).

LongTime This format depends from regional settings.

Example: 5:34:23 PM.

ShortTime This format depends from regional settings.

Example: 17:34.


Warning: Predefined Formats are valid only for languages which have the ability to formatting the date in corresponding of the current LCID (ASP, Java). In the other languages this formats will be equal to the standard US Date/Time formats.

Custom Formats

You can create custom date and time formats by using the following symbols.
Symbol Description
d Day of the month in one or two numeric digits, as needed (1 to 31).
dd Day of the month in two numeric digits (01 to 31).
ddd First three letters of the weekday (Sun to Sat).
dddd Full name of the weekday (Sunday to Saturday).
w Day of the week (1 to 7).
m Month of the year in one or two numeric digits, as needed (1 to 12).
mm Month of the year in two numeric digits (01 to 12).
mmm First three letters of the month (Jan to Dec).
mmmm Full name of the month (January to December).
q Date displayed as the quarter of the year (1 to 4). This format is supported only in ASP, PHP and Perl.
yy Last two digits of the year (01 to 99).
yyyy Full year (0100 to 9999).
h 12-hour format without leading zeros (1 to 12).
hh 12-hour format with leading zeros (01 to 12).
H Hour in one or two digits, as needed (0 to 23).
HH Hour in two digits (0 to 23).
n Minute in one or two digits, as needed (0 to 59).
nn Minute in two digits (00 to 59).
s Second in one or two digits, as needed (0 to 59).
ss Second in two digits (00 to 59).
AM/PM Twelve-hour clock with the uppercase letters "AM" or "PM", as appropriate.
am/pm Twelve-hour clock with the lowercase letters "am" or "pm", as appropriate.
A/P Twelve-hour clock with the uppercase letter "A" or "P", as appropriate.
a/p Twelve-hour clock with the lowercase letter "a" or "p", as appropriate.
ww Week of the year (1 to 53). The first week considered the week which has January 1.
Note: This parameter is not supported in .NET.

Example

The following are examples of custom date/time formats.
Setting Display
ddd, mmm d, yyyy Mon, Jun 2, 1997
mmmm dd, yyyy June 02, 1997
dddd Tuesday

See Also

Date Format Compare, Date format using concept


On-line, printable versions and updates