Re: Conversion back to excel date format
- To: mathgroup at smc.vnet.net
- Subject: [mg73134] Re: Conversion back to excel date format
- From: Bill Rowe <readnewsciv at sbcglobal.net>
- Date: Sun, 4 Feb 2007 07:21:19 -0500 (EST)
On 2/3/07 at 4:24 AM, camartin at snet.net (Clifford Martin) wrote: >I have a list of numbers I've calculated. The last element in the >list is a date in Mathematica format. I needed it to be in that >format to use the Miscellaneous`Calendar functions. When I'm done I >output the list (of lists) to a txt file and read it into Excel. >(The guy I'm working with can only use Excel). >So the list looks something like this for 1 row >{{a,b,c,d,e,f,g,{2004,11,15}}} where a,b,c,d,e,f,g are numbers I've >calculated. I'd like to convert the last element (the date) into a >date format compatible with Excel such as 11/15/2004 before I export >the data. Any suggestions? The Mathematica function FromDate does most of what you need. The rest is realizing FromDate returns seconds from Jan 1, 1900 and Excel stores dates as days from a reference point. So, what you can do is use FromDate@Join[{2004,11,15},{0,0,0}]/86400+a where the value of a will depend on what version of Excel you are using. By formating a cell with a date as a number and comparing it to the value returned by the conversion above, you can establish the value for a you need. -- To reply via email subtract one hundred and four