This command performs one of several operations that may obtain or manipulate strings or values that represent some notion of time. The option argument determines what action is carried out by the command. The legal options (which may be abbreviated) are:
In addition, the following field descriptors may be supported on some systems (e.g. Unix but not Windows):
- %D
- Date as %m/%d/%y.
- %e
- Day of month (1 - 31), no leading zeros.
- %h
- Abbreviated month name.
- %n
- Insert a newline.
- %r
- Time as %I:%M:%S %p.
- %R
- Time as %H:%M.
- %t
- Insert a tab.
- %T
- Time as %H:%M:%S.
If the -format argument is not specified, the format string "%a %b %d %H:%M:%S %Z %Y" is used. If the -gmt argument is present the next argument must be a boolean which if true specifies that the time will be formatted as Greenwich Mean Time. If false then the local timezone will be used as defined by the operating environment.
If the -base flag is specified, the next argument should contain an integer clock value. Only the date in this value is used, not the time. This is useful for determining the time on a specific day or doing other date-relative conversions.
The dateString consists of zero or more specifications of the following form:
The actual date is calculated according to the following steps. First, any absolute date and/or time is processed and converted. Using that time as the base, day-of-week specifications are added. Next, relative specifications are used. If a date or day is specified, and no absolute or relative time is given, midnight is used. Finally, a correction is applied so that the correct hour of the day is produced after allowing for daylight savings time differences.