|Navigation: Language Reference > 3 - Variable Declarations > Picture Tokens >====== Date Pictures ======|
@Dn [s] [direction [range] ] [B]
|@D||All date pictures begin with @D|
|n||Determines the date picture format. Date picture formats range from 1 through 18. A leading zero (0) indicates a zero-filled day or month.|
|s||A separation character between the month, day, and year components. If omitted, the slash ( / ) is used.|
|. (period)||Produces periods|
|` (grave accent)||Produces commas|
|- (hyphen)||Produces hyphens|
|_ (underscore)||Produces spaces|
|direction||A right or left angle bracket (> or <;) that specifies the “Intellidate” direction (> indicates future, <; indicates past) for the range parameter. Valid only on ENTRY date pictures with two-digit years.|
|range||An integer constant in the range of zero (0) to ninety-nine (99) that specifies the “Intellidate” century for the direction parameter. Valid only on ENTRY date pictures with two-digit years. If omitted, the default value is 80.|
|B||Specifies that the format displays as blank when the value is zero.|
There are 18 predefined Date Pictures with the modifiers described above. You can also define your own custom Date Pictures. The literal text in picture tokens can contain any Unicode characters.
Dates may be stored in numeric variables (typically a LONG), a DATE field, or in a STRING type declared with a date picture. A date stored in a numeric type is referred as a “Clarion Standard Date.” The stored value is the number of days since December 28, 1800. The date picture token converts the value into one of the date formats.
The century for dates in any Picture with a two-digit year is resolved using “Intellidate” logic. Date pictures that do not specify direction and range parameters assume the date falls in the range of the next 19 or previous 80 years. The direction and range parameters allow you to change this default. The direction parameter specifies whether the range specifies the future or past value. The opposite direction then receives the opposite value (100-range) so that any two-digit year results in the correct century.
For example, the picture @D1>60 specifies using the appropriate century for each year 60 years in the future and 39 years in the past. If the current year is 1996, when the user enters “5/01/40,” the date is in the year 2040, and when the user enters “5/01/60,” the date is in the year 1960.
For those date pictures which contain month names, the actual names are customizable in an Environment file (.ENV). See the Internationalization section for more information.
Picture Format Result
@D1 mm/dd/yy 10/31/59
@D1>40 mm/dd/yy 10/31/59
@D01 mm/dd/yy 01/01/95
@D2 mm/dd/yyyy 10/31/1959
@D3 mmm dd,yyyy OCT 31,1959
@D4 mmmmmmmmm dd, yyyy October 31, 1959
@D5 dd/mm/yy 31/10/59
@D6 dd/mm/yyyy 31/10/1959
@D7 dd mmm yy 31 OCT 59
@D8 dd mmm yyyy 31 OCT 1959
@D9 yy/mm/dd 59/10/31
@D10 yyyy/mm/dd 1959/10/31
@D11 yymmdd 591031
@D12 yyyymmdd 19591031
@D13 mm/yy 10/59
@D14 mm/yyyy 10/1959
@D15 yy/mm 59/10
@D16 yyyy/mm 1959/10
@D17 Windows Control Panel setting for Short Date
@D18 Windows Control Panel setting for Long Date
@D1. mm.dd.yy Period separator
@D2- mm-dd-yyyy Dash separator
@D5_ dd mm yy Underscore produces space separator
@D6` dd,mm,yyyy Grave accent produces comma separator
In addition to the 18 predefined Date pictures you can construct your custom Date Picture using the following meta-symbols.
All user-defined date pictures begin with @D and end with uppercase D. The character % can be equal to C (Capitalize), L (Lower case) or U (Upper case). The optional parts of the meta-symbols are enclosed in square brackets [ ]:
|d[*]||Day of Month, one digit (only supports days 1-9)|
|dd||Day of Month, two digits always|
|M[*]||Month number, one digit (only supports January..September)|
|MM||Month number, always two digits|
|MMM[%]||Abbreviated Month name|
|MMMM[%]||Full month name|
|MMMMM[%]||Month name; the maximum length is determined by the number of M's in the Picture (must be 5 or more)|
|yy||2 digit year|
|yyyy||4 digit year|
|W[%]||Day of Week abbreviation; the maximum length is determined by the longest value for the current codepage|
|WW[%]||Day of Week abbreviation; maximum length is 2|
|WWW[%]||Day of Week abbreviation; maximum length is 3|
|WWWW[%]||Day of Week full name; the maximum length is determined by the longest value for the current codepage|
|WWWWW[%]||Day of Week full name; the maximum length is determined by the number of W's in the Picture (must be 5 or more)|
Meta-symbol based date pictures must begin and end with uppercase D characters (not counting optional range value and B modifier).
All characters enclosed in double-quotes are treated as literals. To include double-quote as a literal character, two subsequent double-quote characters must be used.
Contents of meta-symbol based @D can't begin with the following combination of characters:
If the Picture needs to be started with any of these literal characters, they must be placed between double-quote characters.
|@D*8||*3 FEB 2019|
|@Ddd MMMMC yyyy, WWWWCD||03 February 2019, Sunday|
|@Ddd-MM yyyy, WWWWCD||03-02 2019, Sunday|
|@DWWWWC dd MMMMC yyyyD||Sunday 03 February 2019|
|@D“Today is” WWWWC dd MMMMC yyyyD||Today is Sunday 03 February 2019|
|@D“Today is” WWWWC dd MMMMU yyyyD||Today is Sunday 03 FEBRUARY 2019|