2016-06-14 21:55:04 +00:00
|
|
|
utc: convert times to UTC
|
|
|
|
|
2016-06-14 22:22:38 +00:00
|
|
|
Usage: utc [-f format] [-u] [-h] [-z zone] [time(s)...]
|
|
|
|
|
2016-06-14 21:55:04 +00:00
|
|
|
utc converts times to UTC. If no arguments are provided, prints the
|
2016-06-14 22:22:38 +00:00
|
|
|
current time in UTC.
|
2016-06-14 21:55:04 +00:00
|
|
|
|
|
|
|
Flags:
|
|
|
|
|
2016-06-14 22:22:38 +00:00
|
|
|
-f format Go timestamp format for input times. See the Go docs
|
2016-06-14 21:55:04 +00:00
|
|
|
(e.g. https://golang.org/pkg/time/#pkg-constants)
|
|
|
|
for an explanation of this format.
|
2016-06-14 22:22:38 +00:00
|
|
|
|
|
|
|
Default value: 2006-01-02 15:04
|
|
|
|
|
|
|
|
-h Print a help message.
|
|
|
|
|
|
|
|
-o format Go timestamp format for outputting times. Uses the
|
|
|
|
same format as the '-f' argument; it defaults to
|
|
|
|
the same value as the '-f' argument.
|
|
|
|
|
|
|
|
-u Timestamps are in UTC format and should be converted
|
|
|
|
to the timezone specified by the -z argument (which
|
|
|
|
defaults to 'Local'). Note that this isn't particularly
|
|
|
|
useful with no arguments.
|
|
|
|
|
2016-06-14 21:55:04 +00:00
|
|
|
-z zone Text form of the time zone; this can be in short
|
|
|
|
time zone abbreviation (e.g. MST) or a location
|
2016-06-14 22:22:38 +00:00
|
|
|
(e.g. America/Los_Angeles). This has no effect when
|
|
|
|
printing the current time.
|
|
|
|
|
|
|
|
Default value: Local
|
2016-06-14 21:55:04 +00:00
|
|
|
|
|
|
|
Examples (note that the examples are done in the America/Los_Angeles /
|
|
|
|
PST8PDT time zone):
|
|
|
|
|
|
|
|
+ Getting the current time in UTC:
|
|
|
|
$ utc
|
|
|
|
2016-06-14 14:30 = 2016-06-14 21:30
|
|
|
|
+ Converting a local timestamp to UTC:
|
|
|
|
$ utc '2016-06-14 21:30'
|
|
|
|
2016-06-14 21:30 = 2016-06-15 04:30
|
|
|
|
+ Converting a local EST timestamp to UTC (on a machine set to
|
|
|
|
PST8PDT):
|
|
|
|
$ utc -z EST '2016-06-14 21:30'
|
|
|
|
2016-06-14 21:30 = 2016-06-15 02:30
|
|
|
|
+ Converting timestamps in the form '14-06-2016 3:04PM':
|
|
|
|
$ utc -f '02-01-2006 3:04PM' '14-06-2016 9:30PM'
|
|
|
|
14-06-2016 9:30PM = 15-06-2016 4:30AM
|
|
|
|
+ Converting timestamps from standard input:
|
|
|
|
$ printf "2016-06-14 14:42\n2016-06-13 11:01" | utc -
|
|
|
|
2016-06-14 14:42 = 2016-06-14 21:42
|
|
|
|
2016-06-13 11:01 = 2016-06-13 18:01
|
|
|
|
+ Converting a UTC timestamp to the local time zone:
|
|
|
|
$ utc -u '2016-06-14 21:30'
|
|
|
|
2016-06-14 21:30 = 2016-06-14 14:30
|
|
|
|
+ Converting a UTC timestamp to EST (on a machine set to
|
|
|
|
PST8PDT):
|
|
|
|
$ utc -u -z EST '2016-06-14 21:30'
|
|
|
|
2016-06-14 21:30 = 2016-06-14 16:30
|
2016-06-14 22:22:38 +00:00
|
|
|
+ Using a different output format:
|
|
|
|
$ utc -o '2006-01-02T15:03:04MST' '2016-06-14 21:30'
|
|
|
|
2016-06-14 21:30 = 2016-06-15T04:04:30UTC
|
2016-06-14 21:55:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
|