mtime ?-locale str? ?-format str? time ?kind?
Return date and time strings given a Mac epoch time (i-e a time specified as the number of seconds that have elapsed since Midnight Jan 1, 1904, as typically obtained from the [now] command).
The -locale option lets you specify the locale to use for formatting the date and time strings. If this option is not specified, the current locale of your system is used. The value of this option is a locale identifier using the usual Unix syntax language[_country] (like en, en_US, en_GB, fr_FR, etc.)
The -format option lets you specify a template string containing date format patterns. For full details regarding the patterns syntax, see Unicode Technical Standard #35. Note that the date format components given in the template are arranged appropriately for the specified locale. The returned string may not contain exactly those components given in the template string, but may have locale-specific adjustments applied. Here are some examples using the american and japanese locales respectively:
«» mtime -locale en_US -format EdMMM [now]
Sat, Oct 5
«» mtime -locale ja_JP -format EdMMM [now]
10月5日(土)
Alternatively, the optional kind argument specifies the format in which the date is displayed. The possible format values are: abbreviated, full, long, offset, short, standard. These values may be abbreviated. The default value is standard which corresponds to the fixed format YYYY-MM-DD HH:MM:SS. The offset format is like the standard format but also appends the time zone offset. The other formats provide localized date and time using the current locale. Here are some examples (using the en_US locale) to demonstrate the different kinds:
abbreviatedOct 5, 2019 1:52:56 PM
fullSaturday, October 5, 2019 1:52:56 PM Central European Summer Time
longOctober 5, 2019 1:52:56 PM GMT+2
offset2019-10-05 13:52:56 GMT+2
short10/5/19 1:52 PM
standard2019-10-05 13:52:56
If the -format option is specified, the kind argument is ignored. If no -format option and no kind argument are specified, the command uses the standard kind.
If the -format option is specified, the returned value is a single string. Otherwise, it is a two-element list: the first element is the date, the second one is the time. To get a single string, use the [join] command.