CustomFormat
property for PowerScript controls
Applies to
DatePicker controls
Description
The CustomFormat property specifies a custom format for the display
of the date in a DatePicker control. You must set the Format property to
the enumerated value dtfCustom! for the CustomFormat to take
effect.
The format strings in the following table can be combined to format
the date and time. If you want to include string literals in the
CustomFormat string, enclose them in single quotes to ensure that the
letters they contain are not interpreted as format strings.
|
Format string |
Description |
|---|---|
|
d |
The one- or two-digit day. |
|
dd |
The two-digit day. Single-digit day values are |
|
ddd |
The three-character weekday |
|
dddd |
The full weekday name. |
|
h |
The one- or two-digit hour in 12-hour |
|
hh |
The two-digit hour in 12-hour format. Single-digit |
|
H |
The one- or two-digit hour in 24-hour |
|
HH |
The two-digit hour in 24-hour format. Single-digit |
|
m |
The one- or two-digit minute. |
|
mm |
The two-digit minute. Single-digit values are |
|
M |
The one- or two-digit month. |
|
MM |
The two-digit month. Single-digit values are preceded |
|
MMM |
The three-character month |
|
MMMM |
The full month name. |
|
s |
The one- or two-digit second. |
|
ss |
The two-digit second. Single-digit values are |
|
t |
The one-letter abbreviation for AM or PM in uppercase |
|
tt |
AM or PM in uppercase. |
|
X |
A callback field used to query the user for a portion |
|
y |
The one-digit year (2007 displays as |
|
yy |
The two-digit year (2007 displays as |
|
yyy or yyyy |
The full year (2007 displays as |
Usage
In the painter
To set the CustomFormat property:
-
Select dtfcustom! from the Format drop-down list on the General
page of the control’s Properties view. -
Specify a custom format in the Custom Format field.
This custom format displays the date and time at 8 p.m. on the first
day of 2007 as January 1, 2007 08:00:00 PM:
|
1 |
MMMM d, yyyy hh:mm:ss tt |
This custom format displays the same time on the last day of 2006 as
December 31, 2007 20:00:00 PM:
|
1 |
MMMM d, yyyy HH:mm:ss |
In scripts
The CustomFormat property takes a string value. The following
statements set the Format property to allow a custom format, then set the
custom format to display the full month name, the two-digit date followed
by a comma, and the full year:
|
1 2 |
dp_1.Format = dtfCustom! dp_1.CustomFormat = 'MMMM dd, yyyy' |