Workbench User Guide : C. Data Format Templates : Date Format Templates : Absolute Date and Time Format Templates
 
Share this page                  
Absolute Date and Time Format Templates
You can specify the absolute date and time template formats for entry fields with a date data type by entering an example date indicating exactly how you want each date and time element to be printed. You specify an absolute date and time template by entering the template in the field's FormatString property in the Property Inspector.
Note:   
If you specify an absolute date and time template by setting the FormatString attribute in your 4GL code, you must place double quotation marks (") around the example date. For more information about the FormatString attribute, see the Language Reference Guide.
Do not use the “d” and enclosing quotation marks.
The following representative date and time is the example value used when specifying the date format:
Sunday, 1901 February 3 at 4:05:06 p.m.
In this template:
Sunday represents the day of the week
1, 01, or 1901 represents the year
2 or 02 represents the month
3 or 03 represents the day of the month
4 or 04 represents the hour
5 or 05 represents the minute
6 or 06 represents the second
p or p.m. represents a.m. or p.m.
This example date is used because Sunday is the first day of the week, and arguments 1, 2, 3, 4, 5, and 6 are the year, month, day, hour, minute, and second, respectively.
When you specify a date or time format, you use the example elements to indicate both position and style as follows:
Day
Includes the example word Sunday in the date template to include the appropriate day of the week as part of the date when displaying dates in the field.
Month
Uses either a single or double digit for the month. Use a 2 (single digit) for the month to display the months of January through September as a single digit.
For example, July is displayed as 7 and November as 11. Use 02 for the month to display all the months as two-digit numbers. In this case, July appears as 07. Use the example month “February” to print the month name. In this case, July appears as “July.”
Year
Specifies the year in the same manner as the month. If you use the single digit 1 in the template to indicate the year, the years zero through nine are displayed with only one digit. The year 2004 appears as 4, while 2014 appears as 14.
Examples: Date and time formats
If you use the four digits 1901, all four digits of the year are displayed. For example, 2004 is displayed as 2004.
You can arrange the arguments in various combinations in any order. For example:
3/2/1 tells OpenROAD to display first the day (3), then the month (2), and then the year (1) with each element separated by slash marks.
The date January 15, 1988, appears as 15/1/88.
In the template Sunday 2/3/1, the date January 15, 1988, is displayed as Friday 1/15/88.
Note:  Separators and other characters are reproduced in the field exactly as they are entered in the template. To use one of the special reserved template characters or symbols, precede it with a backslash. For example, to use the numeral 2 in the date template as a constant rather than the template symbol for month number, enter it as \2.
Guidelines for Using Absolute Date Templates
Observe the following guidelines when using absolute date templates:
On a date template you can enter only the month's name of February, the weekday of Sunday, and the time designation p or p.m.
You can specify 24-hour time by using 16 instead of 4 for 4 p.m.
You cannot use p or p.m. with 24-hour time.
Display the numeric day of the year by specifying the day and year, but leaving out the month.
For example, 3/1901 in the template results in dates like 121/1988 for April 30, 1988.
You can create ordinal numbers from numerals by appending the appropriate suffix (st, nd, rd, or th).
For example, the template 3rd day of February 1901 produces a date like 15th day of January, 1988.
Numbers requiring more than one digit use up preceding blanks or zeros.
If there are no preceding blanks or zeros remaining, the number expands to the right. A blank following a letter, word, or number is not used up by a succeeding number. Columns of numbers can be lined up by preceding them with an appropriate number of blanks or zeros.
Examples of Absolute Date Templates
The following table provides examples of absolute date and time templates:
Format
Example Data
Output
2/3/1
25-oct-1982
10/25/82
2/3/1
5-jun-1909
6/5/9
2/ 3/01
25-oct-1982
10/25/82
2/ 3/01
5-jun-1909
6/ 5/09
03-02-01
5-oct-1982 07:24:12
05-10-82
010203
5-oct-1982
821005
1\|2\|3
5-oct-1982
82|10|5
FEBRUARY, 1901
1-sep-2134 09:13:02
SEPTEMBER, 2134
FEBRUARY, 1901
2-apr-1962 17:46:03
APRIL, 1962
Sunday
5-oct-1983
Wednesday
SUN Feb 3 16:05 1901
13-oct-1983 07:24:03
THU Oct 13 07:24 1983
FEB 03 4:05:06 p.m.
12-dec-1983 22:13:03
DEC 12 10:13:03 p.m.
04:05:06 PM
5-oct-1983 14:08:45
02:08:45 PM
04:05:06 PM
5-oct-1983 07:29:12
07:29:12 AM
16:05 pst
5-oct-1983 14:08:45
14:08 pst
3/01
5-oct-1983
278/83
February 3rd
29-jul-1954
July 29th
3rd day of 1901
11-may-1999
131st day of 1999