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.