From Fedora Project Wiki

mNo edit summary
(Lots of cleanup, syntactically and stylistically.)
Line 5: Line 5:
== What is UTC? ==
== What is UTC? ==


Coordinated Universal Time (UTC) is the official world time.  Your local time is this world time plus or minus an offset. For most timezones this offset is an multiple of an hour.  Typical dates in UTC look like these:
Coordinated Universal Time (UTC) is the official world time.  Localized times can be calculated through addition or subtraction on the current UTC time. For most timezones, this conversion uses integer multiples of hours (i.e. +1:00, +2:00, -3:00, etc).  Typical dates in UTC can look like these:
<pre>
<pre>
2007-06-07 04:00 UTC
2007-06-07 04:00 UTC
Line 11: Line 11:
2007-06-07T04:00UTC
2007-06-07T04:00UTC
</pre>
</pre>
You can find a long article about UTC at [http://en.wikipedia.org/wiki/UTC Wikipedia] .
You can find a long article about UTC at [http://en.wikipedia.org/wiki/UTC Wikipedia].


== How can I convert UTC into localtime? ==
== How can I convert UTC into local time? ==


There are several ways:
There are several ways:


# Do mental arithmetic.  You need to know the offset of you timezone and add it to UTC.  A table with some timezone offsets is below.
# Do mental arithmetic.  You need to know the offset of your timezone and add it to the current UTC time.  A table with some time zone offsets is below.
# You can use the commandline tool ''date'' for this.  This only works when you use a machine that is configured to display your timezone. <pre>$ date -d '2007-06-07 04:00 UTC'
# You can use the command line tool ''date'' for this.  This only works when you use a machine that is configured to display your time zone. <pre>$ date -d '2007-06-07 04:00 UTC'</pre> This would print: <pre>Thu Jun  7 00:00:00 EDT 2007</pre> for someone using Eastern Daylight Time.
Thu Jun  7 00:00:00 EDT 2007</pre>
# You can use an [http://www.timeanddate.com/worldclock/converter.html online time calculator].
# You can use an [http://www.timeanddate.com/worldclock/converter.html online time calculator]  


== How can I convert my/any localtime into UTC? ==
== How can I convert my/any localtime into UTC? ==
# Do mental arithmetic.  You only need to substract the offset of your timezone from your localtime to get UTC.  A table with some timezone offsets is below.
# Do mental arithmetic.  You only need to substract the offset of your timezone from your local time to get UTC.  A table with some time zone offsets is below.
# You can use the commandline tool ''date'' for this. <pre>$ date -u -d "2007-06-07 00:00 EDT" +"%Y-%m-%d %H:%M %Z" </pre>
# You can use the commandline tool ''date'' for this.
# the given time in UTC <pre>2007-06-07 04:06 UTC</pre>
## You can use the -d option to provide a date to convert: <pre>$ date -u -d "2007-06-07 00:00 EDT" +"%Y-%m-%d %H:%M %Z" </pre> Yields the converted time in UTC: <pre>2007-06-07 04:06 UTC</pre>
# this converts the time to UTC <pre>$ date -u +"%Y-%m-%d %H:%m %Z"</pre>
## Ignore the -d option to use the current system time.<pre>$ date -u +"%Y-%m-%d %H:%m %Z"</pre> Yield the current converted time in UTC:<pre>2007-06-29 20:06 UTC</pre>
# the current time in UTC <pre>2007-06-29 20:06 UTC</pre>
# You can use the graphical tool ''international-time'': <pre>$ international-time</pre>
# You can use the graphical tool ''international-time'': <pre>$ international-time</pre>
# You can use an [http://www.timeanddate.com/worldclock/converter.html online time calculator]  
# You can use an [http://www.timeanddate.com/worldclock/converter.html online time calculator].


== Table of timezones ==
== Table of timezones ==
A very complete, albeit somewhat intimidating list of time zones listed by their UTC conversion factor can be found [http://en.wikipedia.org/wiki/List_of_time_zones on Wikipedia].  They use the convention UTC+X to sort the zones.  If you lived in New York, for example, you would look under UTC-4.  If you liven in Berlin using CET, you would look under UTC+1.
{| style="t1" rowclass="th"
{| style="t1" rowclass="th"
|-
|-

Revision as of 15:38, 3 October 2008

UTC Howto

What is UTC?

Coordinated Universal Time (UTC) is the official world time. Localized times can be calculated through addition or subtraction on the current UTC time. For most timezones, this conversion uses integer multiples of hours (i.e. +1:00, +2:00, -3:00, etc). Typical dates in UTC can look like these:

2007-06-07 04:00 UTC
2007-06-07 04:00 +0000
2007-06-07T04:00UTC

You can find a long article about UTC at Wikipedia.

How can I convert UTC into local time?

There are several ways:

  1. Do mental arithmetic. You need to know the offset of your timezone and add it to the current UTC time. A table with some time zone offsets is below.
  2. You can use the command line tool date for this. This only works when you use a machine that is configured to display your time zone.
    $ date -d '2007-06-07 04:00 UTC'
    This would print:
    Thu Jun  7 00:00:00 EDT 2007
    for someone using Eastern Daylight Time.
  3. You can use an online time calculator.

How can I convert my/any localtime into UTC?

  1. Do mental arithmetic. You only need to substract the offset of your timezone from your local time to get UTC. A table with some time zone offsets is below.
  2. You can use the commandline tool date for this.
    1. You can use the -d option to provide a date to convert:
      $ date -u -d "2007-06-07 00:00 EDT" +"%Y-%m-%d %H:%M %Z" 
      Yields the converted time in UTC:
      2007-06-07 04:06 UTC
    2. Ignore the -d option to use the current system time.
      $ date -u +"%Y-%m-%d %H:%m %Z"
      Yield the current converted time in UTC:
      2007-06-29 20:06 UTC
  3. You can use the graphical tool international-time:
    $ international-time
  4. You can use an online time calculator.

Table of timezones

A very complete, albeit somewhat intimidating list of time zones listed by their UTC conversion factor can be found on Wikipedia. They use the convention UTC+X to sort the zones. If you lived in New York, for example, you would look under UTC-4. If you liven in Berlin using CET, you would look under UTC+1.

EDT US/Eastern Daylight Time New York -0400 2007-06-07 00:00 EDT
CET Central European Time Berlin +0100 2007-06-07 05:00 CET
CEST Central European Summer Time Berlin +0200 2007-06-07 05:00 CEST