18. Working with Data Types and Data Display Formats : Date and Time Templates : Absolute Date and Time Templates : Absolute Date and Time Template Specification
 
Share this page                  
Absolute Date and Time Template Specification
You can use the following representations of components in a date and time template, with the exceptions noted in the table that follows:
Sunday, Sun, or Su represents a day of the week
1, 01, or 1901 represents the year
2, 02, February, Feb, or Fe, represents the month
3 or 03 represent the day of the month
4, 04, or 16 (24‑hour time) represent the hour
5 or 05 represent minutes
6 or 06 represent seconds
p or p.m. represent the designations am or pm
This is easy to remember 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.
The following rules apply when using the representative date components to indicate position and style:
Day
You can specify the day as an ordinal number by suffixing it with the appropriate abbreviation: st, nd, rd, or th. For example, the template 3rd day of February 1901 produces a date such as 15th day of January 1998.
If input masking is on, you cannot use the full name of the day, Sunday, or ordinal numbers and their abbreviations. If you use the single digit 3 for the day, you must precede it with a space. For more information, see Input Masking for Absolute Dates.
Month
You can use 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 and the months of October through December as a double digit. For example, if you specify 2 for the month, July appears as month 7 and November appears as month 11. Use 02 for the month to display or enter all months as two‑digit numbers. In this case, July appears or is entered as 07.
If input masking is on, you must precede the single digit 2 with a space in your template. You cannot use the full name of the month, February. For more information, see Input Masking for Absolute Dates (see page Input Masking for Absolute Dates).
Year
If you use the single digit 1 in the template to indicate the year, the years zero through nine are displayed or entered with only one digit; double‑digit years are displayed as two digits. For example, specifying 1 for the year displays 2004 as 4 and 2014 as 14. If you use the four digits 1901, all four digits of the year are displayed. Thus, 2004 is displayed as 2004.
If input masking is on, you must precede the single digit 1 with a space in your template. For more information, see Input Masking for Absolute Dates (see page Input Masking for Absolute Dates).
Time
You can specify 24‑hour (military) time by using 16 instead of 4 for the hour. You cannot use p or p.m. with 24‑hour time.
Order
You can arrange the arguments in various combinations in any order. For example, 03/02/01 displays first the day (3), the month (2), and the year (1), with each element separated by slashes. The date January 15, 1998 appears as 15/01/98. If your template is Sun 03/02/01, the date January 15, 1998 appears as Saturday 15/01/98. Similarly, 1901.02.03 first displays the year, the month, and the day, separated with periods, resulting in 1998.01.15.
Constant characters
Separators and other constant characters in your template, such as forward slashes (/) and periods (.), are displayed exactly as indicated in the template.
Reserved characters
If you want to use one of the special reserved template characters or symbols as an explicit character in your template, you must precede it with a backslash (\). For example, if you want to use the numeral 2 in the date template as a constant rather than as the template symbol for the month number, you must enter it as \2.
If input masking is on, you cannot use the vertical bar (|) as a special alignment character.
Ingres displays as a string constant any word you include in a date template other than the month name of February (or its allowed abbreviations), the weekday of Sunday (or its allowed abbreviations), and the time designation p or p.m.
You can combine any of the values given to specify your template, but be aware that some combinations of those values can lead to incorrect outputs. For example, you can display the numeric day of the year by specifying the day and year but leaving out the month. Therefore, 3/1901 in the template results in dates like 9/1998 for January 9, 1998, and 121/1998 for April 30, 1998. Also note that you can display just the numeric representation for month and year by leaving out the day-year and day-month. This results in outputs such as 3 for March 6, 1998, when specifying the template 02, and 98 for April 4, 1998, when specifying the template 01. However, when you use templates with 03, leaving out the month and the year, the template does not return the day of the month; instead, it returns the number of days since January 1, 1582 (Gregorian calendar), which leads to outputs like 151943 for February 1, 1998.
Numbers requiring more than one digit use up preceding blanks or zeroes. If there are no preceding blanks or zeroes left, the number expands to the right. A succeeding number does not use up a single blank immediately following a letter, word, or number. Columns of numbers can be lined up by preceding them with an appropriate number of blanks or zeroes.
Because full month and weekday names (as well as numbers without preceding blanks or zeros) are of differing lengths, date columns using these components in the format do not usually line up when displayed in columns. Follow February or Sunday with a vertical bar (|) to specify that for shorter month names or weekdays, an appropriate number of blanks is substituted for the vertical bar to line up the components. When you follow a single digit in your template with a vertical bar, each single‑digit entry is automatically preceded with a space, to line up single and double‑digit entries.
For example, the template Sunday,| February | 3,| 1901 produces dates like:
Friday, January 15, 1998
Wednesday, May 4, 1998
Saturday, November 20, 1998
Any character preceded by a backslash (\) is printed as it appears.