CustomFormat property for PowerScript controls
Controls
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 |
ddd |
The three-character weekday abbreviation. |
dddd |
The full weekday name. |
h |
The one- or two-digit hour in 12-hour |
hh |
The two-digit hour in 12-hour format. |
H |
The one- or two-digit hour in 24-hour |
HH |
The two-digit hour in 24-hour format. |
m |
The one- or two-digit minute. |
mm |
The two-digit minute. Single-digit values |
M |
The one- or two-digit month. |
MM |
The two-digit month. Single-digit values |
MMM |
The three-character month abbreviation. |
MMMM |
The full month name. |
s |
The one- or two-digit second. |
ss |
The two-digit second. Single-digit values |
t |
The one-letter abbreviation for AM or |
tt |
AM or PM in uppercase. |
X |
A callback field used to query the user |
y |
The one-digit year (2007 displays as “7”). |
yy |
The two-digit year (2007 displays as “07”). |
yyy or yyyy |
The full year (2007 displays as “2007”). |
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 asJanuary 1, 2007 08:00:00
:
PM1MMMM d, yyyy hh:mm:ss ttThis custom format displays the same time on the last day
of 2006 asDecember 31, 2007 20:00:00 PM
:1MMMM 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 |
dp_1.Format = dtfCustom!<br>dp_1.CustomFormat = "MMMM dd, yyyy" |