Re: Converting Dates to Mathematica Format
- To: mathgroup at smc.vnet.net
- Subject: [mg52099] Re: Converting Dates to Mathematica Format
- From: bghiggins at ucdavis.edu (Brian Higgins)
- Date: Wed, 10 Nov 2004 04:46:17 -0500 (EST)
- References: <cmpq66$mot$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Greg, Will this work for you: ls = {{23, 45, "15/10/2004"}, {13, 467, "23/07/1999"}, {78, 81, "03/02/2001"}} Map[ToExpression[Read[StringToStream[#], {Word, Word, Word}, WordSeparators -> {"/"}] /. {x_, y_, z_} -> {z, y, x}] & ,ls[[All,3]]] {{2004, 10, 15}, {1999, 7, 23}, {2001, 2, 3}} Cheers, Brian Gregory Lypny <gregory.lypny at videotron.ca> wrote in message news:<cmpq66$mot$1 at smc.vnet.net>... > Hello Everyone, > > Is there a simple way to convert dates imported as "Day/Month/Year" to > the Mathematica format of {Year, Month, Day}? My dates are one column > in a matrix of data. Mathematica appears to be treating them as > strings. I used StringReplace to turn 15/10/2004 to 15,10,2004 but it > remains a string, of course. > > Any suggestions would be most appreciated. My alternative is to import > all of the dates as 20041510 so the ordinal ranking is maintained by > date calculations would not be possible. > > Greg