ASN.1 GeneralizedTime tag: 24
The ASN.1 GeneralizedTime type consists of strings of digits and certain characters, and provides three ways of describing time:
- Local time can be described as a four-digit year, a two digit month, a two-digit day, a two-digit hour (based on a twenty four hour clock) a two-digit minute, and a two-digit second with a decimal point and digit ("YYYYMMDDHH[MM[SS[.fff]]]"). For example, "8:30 p.m. on April 15, 1988" is represented by the string "19880415203000.0".
- Coordinated Universal Time (UTC time) can be described as a string of the form described above followed by an uppercase "Z", which indicates that the value is UTC time rather than local time.
- A value described as in the first case may be followed by an indication of the differential from UTC time. For example, the string "19880415203000.0-0600" represents "8:30 p.m. on April 15, 1988", but also indicates that this local time is 6 hours behind UTC time.
Although a four-digit year is used and some potential ambiguities are removed, it is recommended to use DATE, TIME-OF-DAY, or DATE-TIME types instead of GeneralizedTime, as they fully support ISO 8601, the definitive standard for time and date representations.
CreationTime ::= GeneralizedTime
msgSent GeneralizedTime ::= "19960415203000.0-0600"
GeneralizedTime encoding example
fileCreated GeneralizedTime ::= "19960415203000.0"
In BER, the GeneralizedTime type value defined in the example above is encoded as follows:
18 0C 313939363034313532303330
The GeneralizedTime type can be constrained by a single value.