Mini-HOWTO: What Time is UTC?
I wanted to know what time it was in UTC, but I forgot my local offset. (It changes twice a year!) I figured I could look in the date man page, but I came up with an “easier” solution. Simply fudge the time zone and then ask.
0-20:57 djh@noneedto ~$ env TZ=UTC date Tue May 6 03:57:07 UTC 2008
The env bit is not needed in bash, but it makes tcsh happy.
Update: Mark points out an easier solution:
date -u
Knowing you can set TZ= is still useful in case you ever need to contemplate an alternate timezone.
Responses
dbt
env TZ= date works just as well, without needing to be undone…
dannyman
(Thanks, dbt . . . this post just got a lot shorter. ;)
mark
How about ‘date -u’?
Comment
Tiny Print:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>