Fields - formats (date)¶
Contents
Date format templates¶
A date format template may be assigned to a day number field (logical type dn), or to a time and date field (logical type td). The format for a td type field is composed of a time format followed by a date format.
The following characters are used in the definition of date formats:
d, D |
Day. This part of a date format template consists of two consecutive d characters, each of which may be upper or lower case. The case of the first d|D determines whether a space or a zero will be displayed in this position if the digit is not significant (i.e. the day number is less than 10.) If the first day character is d, a space is displayed if the digit is not significant. If the first day character is D, a zero is displayed if the digit is not significant. The case of the second day character is irrelevant. A single d (or D) is not recognised as a day and is displayed unaltered. If more than two consecutive d’s (or D’s) appear the first two are treated as a day and the remainder displayed unaltered. |
m, M |
Month. This part of a date format template consists of two or three consecutive m characters, each of which may be upper or lower case. If two characters are used, the month is displayed as a number. The case of the first m|M determines whether a space or a zero will be displayed in this position if the digit is not significant (i.e. the month number is less than 10.) If the first month character is m, a space is displayed if the digit is not significant. If the first day character is M, a zero is displayed if the digit is not significant. The case of the second month character is irrelevant. If three characters are used, the month is displayed as the first three characters of its name (e.g. Jan, Feb). The case of each character in the format template determines the case in which the corresponding character will be displayed (i.e. MMM produces JAN, Mmm produces Jan). The month names may be changed by means of the configurable text editor sctextw. They are stored as Item 55 in the file called common. A single m (or M) is not recognised as a month and is displayed unaltered. If more than three consecutive m’s (or M’s) appear the first three are treated as a three-character month name and the remainder displayed unaltered. |
y, Y |
The year part of a date format template consists of two or four consecutive y characters, each of which may be upper or lower case. If two characters are used, the value 1900 or 2000 is automatically added to the year number upon input. The case of the first y|Y determines whether a space or a zero will be displayed in this position if the digit is not significant. If the first year character is y, a space is displayed if the digit is not significant. If the first year character is Y, a zero is displayed if the digit is not significant. It is possible to define a three-character year format. This causes the last three digits of the year number to display. A single y (or Y) is not recognised as a year and is displayed unaltered. If more than four consecutive y’s (or Y’s) appear the first four are treated as a four-character year and the remainder displayed unaltered. See Date configuration for details of the treatment of 2-character input and how to force 4-character input. |
Any other character appearing in a date format is displayed unaltered in its assigned position. This enables separator characters and even text to be embedded in the format.
The constituent parts of a date format may appear in any order and need not all be present.
Default date format¶
The default date format template is specified in the configuration file called common, which is accessed by means of the configurable text editor sctextw. Item 61 in the file common defines the default format for fields of type dn. This format is used if no template is included in the field specification. The default issued with Sculptor is dD/mM/YY.
The default format for time and date fields (type td) is item 61 in the file common. The default issued with Sculptor is HH:MM,dD/mM/YY.
Date formats and alphanumeric fields¶
Date formats may be assigned to alphanumeric fields that have the flag d:
!temp alphadate,,a11,“DD/MMM/YYYY”,d
This indicates that whenever a numeric value is to assigned to the field, it is assumed to be a day number and is formatted using the field format if present. If no field format was provided the default date format is used.
Date configuration¶
EXAMPLE
Format |
Result |
“dd/mm/yyyy” |
1/ 1/1995 |
“dD:MM:YY” |
1:01:95 |
“DD/mm/YYYY” |
01/ 1/1995 |
“Mmm dd yy” |
Jan 1 95 |
“DD-MMM-YYYY” |
01-JAN-1995 |
“YYYY (Mmm)” |
1995 (Jan) |
“The year is YYYY” |
The year is 1995 |
RELATED TOPICS |