Re: date format
- To: mathgroup at smc.vnet.net
- Subject: [mg75127] Re: date format
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Wed, 18 Apr 2007 04:57:46 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <f015bp$9sk$1@smc.vnet.net>
Arkadiusz.Majka at gmail.com wrote: > Dear All, > > Form the following date format > > 04/Dec/2006:19:54:02 > > could you please show me how to get the following representation {day, > month, year, hour, minutes, seconds} - so exactly the same as for > Date[] > > Thank you, > > Arek > > You could try the following: In[1]:= rules = {"Jan" -> 1, "Dec" -> 12}; date = "04/Dec/2006:19:54:02"; ToExpression[StringSplit[date, Characters["/:"]] /. rules][[{3, 2, 1, 4, 5, 6}]] Out[3]= {2006, 12, 4, 19, 54, 2} which is in the same format as the expression returned by Date[] on my system. In[4]:= Date[] Out[4]= {2007, 4, 17, 15, 16, 29.0625`9.215907880295621} Regards, Jean-Marc