Machine date and Mathematica Date
- To: mathgroup at smc.vnet.net
- Subject: [mg53056] Machine date and Mathematica Date
- From: János <janos.lobb at yale.edu>
- Date: Wed, 22 Dec 2004 04:52:46 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hi, I am wondering what others are doing to sync Mathematica date functions with the OS date functions. For example the Book says that Mathematica starts date on Jan 1st 1900. Most unix systems, OSX among them, starts the date at Jan 1st 1970, plus minus the time zone. The reason that I am asking because I have some date values generated by the OS which I want to parse and process in Mathematica. If I do nothing all the tick marks will show date from the 1934 or so. for example a record looks like this: Mon Dec 20 13:18:02 EST 2004, 1103566682, 1103566692} normal unix date, then transaction start date in seconds from the epoch start and the transaction end date from the epoch start of the OS. If I convert it back with Mathematica In[8]:= ToDate[ToExpression["1102635159"]] Out[8]= {1934,12,10,23,32,39.} then it is not exactly 2004. The difference is the difference between the start of the two epoch: In[10]:= FromDate[{2004,12,9,18,32,39}] Out[10]= 3311605959 In[12]:= ToDate[3311605959-1102635159] Out[12]= {1969,12,31,19,0,0.} If I do adjustments, then I would like to do something smart, not just my own simple shift. I looked the date functions in Mathematica, but saw no epoch adjustments there. Thanks ahead, János ---------------------------------------------------------- "A cyber virgin has never had intercourse outside of virtual reality, whereas a virtual virgin has never had intercourse with a real person even in virtual reality" -Ray Kurzweil - "The age of spiritual machines"