- YYYY are at least four decimal digits giving the year.
- MM, DD, hh, mm, and SS are as with −t time.
- T is the time designator, and can be replaced by a single <space>.
- [.frac] and [,frac] are either empty, or a <period> ('.') or a <comma> (',') respectively, followed by one or more decimal digits, specifying a fractional second.
- [tz] is either empty, signifying local time, or the letter 'Z', signifying UTC. If [ tz] is empty, the resulting time shall be affected by the value of the TZ environment variable.
If the resulting time precedes the Epoch, the behavior is implementation-defined. If the time cannot be represented as the file's timestamp, touch
shall exit immediately with an error status.
where each two digits represents the following:
- The month of the year [01,12].
- The day of the month [01,31].
- The hour of the day [00,23].
- The minute of the hour [00,59].
- The first two digits of the year (the century).
- The second two digits of the year.
- The second of the minute [00,60].
shall be optional. If neither is given, the current year shall be assumed. If YY
is specified, but CC
is not, CC
shall be derived as follows:
|If YY is: ||CC becomes: |
|[69,99] ||19 |
|[00,68] ||20 |
- It is expected that in a future version of this standard the default century inferred from a 2-digit year will change. (This would apply to all commands accepting a 2-digit year as input.)
The resulting time shall be affected by the value of the TZ
environment variable. If the resulting time value precedes the Epoch, the behavior is implementation-defined. If the time is out of range for the file's timestamp, touch
shall exit immediately with an error status. The range of valid times past the Epoch is implementation-defined, but it shall extend to at least the time 0 hours, 0 minutes, 0 seconds, January 1, 2038, Coordinated Universal Time. Some implementations may not be able to represent dates beyond January 18, 2038, because they use signed int
as a time holder.
The range for SS
is [00,60] rather than [00,59] because of leap seconds. If SS
is 60, and the resulting time, as affected by the TZ
environment variable, does not refer to a leap second, the resulting time shall be one second after a time where SS
is 59. If SS
is not given a value, it is assumed to be zero.