Mathematica Technical FAQs Services & Resources / Mathematica / Systems & Installation / Linux
-----
 /
Intel
*Mathematica
*Network Mathematica
*webMathematica
*gridMathematica
*Personal Grid Edition
*Wolfram Workbench
*Wolfram Education Group
*Application Packages
*Mathematica for Students
*Mathematica CalcCenter
*Publicon
*A New Kind of Science Explorer
*Mathematical Explorer
*Mathematica Teacher's Edition
*Calculus WIZ
*Mathematica Player
*Ask about this page
*Print this page
*Email this page
*Give us feedback
*
Sign up for our newsletter:

Why is the output of Date[] several hours off?

The inaccuracies in the hour element of the output of Date and the output of TimeZone is due to Mathematica thinking that your time zone is Greenwich Mean Time (GMT).

These Date and TimeZone errors are caused by a subtle change in how compiled programs interact with the time zone database that accompanies the GNU standard C library. The interaction with this database is defined by the version of the GNU standard C library which is used to build Mathematica.

Mathematica is statically linked to libc-5.x. If your Linux OS uses glibc-2.1.x, Mathematica will default to a value of 0 for TimeZone when it fails to access the correct value from the time zone database.

For example, if you reside in Champaign, Illinois (Central Standard Time), you would see:

In[1]:=
Out[1]=
 

 
In[2]:=
Out[2]=
 

 

The results should actually be:

In[3]:=
Out[3]=
 

 
In[4]:=
Out[4]=
 

 

Our developers are aware of this problem. We expect to have this fixed by the next major release of Mathematica.

Passing a time zone value to Date returns the time for that zone. This can be used to workaround the inaccurate time problem by redefining Date to adjust the time for your time zone. This example would correct the Date function for Central Standard Time. (CST is calculated by subtracting 6 hours from GMT.)

In[5]:=
Out[5]=
 

 
In[6]:=
In[7]:=
Out[7]=
 

 

Here is a list of time zones with their corresponding adjustments with respect to GMT.

Midway IslandGMT-11
AST—Aleutian StandardGMT-10
AKST —Alaska StandardTimeGMT-9
PST—Pacific Standard TimeGMT-8
MST—Mountain Standard TimeGMT-7
CST—Central Standard TimeGMT-6
EST—Eastern Standard TimeGMT-5
AST—Atlantic Standard TimeGMT-4
part of GreenlandGMT-3
Mid–AtlanticGMT-2
AT—Azores TimeGMT-1
GMT—Western Europe TimeGMT
CET—Central Europe TimeGMT+1
EET—Eastern Europe TimeGMT+2
MSK—Moskow TimeGMT+3
Russia Zone 3GMT+4
Russia Zone 4GMT+5
Russia Zone 5GMT+6
Russia Zone 6GMT+7
Russia Zone 7GMT+8
Russia Zone 8GMT+9
Russia Zone 9GMT+10
Russia Zone 10GMT+11
Russia Zone 11GMT+12

You can place the definition of FixedDate in the Kernel's init.m file so that it will be automatically evaluated and ready to use each time the Mathematica Kernel is launched. More information on how to edit the Kernel's init.m file can be found at http://support.wolfram.com/mathematica/kernel/files/initmconfigure.html

Download this FAQ as a Mathematica 5.2 Notebook






 © 2008 Wolfram Research, Inc.  Terms of Use  Privacy Policy | [ja]