Re: split a number to Date format
- To: mathgroup at smc.vnet.net
- Subject: [mg124256] Re: split a number to Date format
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sat, 14 Jan 2012 17:13:11 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
On 1/14/12 at 2:54 AM, cdmartin at me.com (Derek Martin) wrote:
>I have experimental data in spreadsheet format. The first column is
>a time stamp in the format 111205020000. If I could parse or split
>the number 111205020000 into {11,12,05,02,00,00} and replace the
>first 11 with 2011, the Date commands would work fine. I can do the
>replacing, but am having difficulty seeing how to split the number
>into {11,12,05,02,00,00}.
In[16]:= IntegerDigits[111205020000, 100] /. {a_, b__} :> {2000
+ a, b}
Out[16]= {2011,12,5,2,0,0}
In[17]:= DateString[%]
Out[17]= Mon 5 Dec 2011 02:00:00