Re: data in absolutetime
- To: mathgroup at smc.vnet.net
- Subject: [mg109920] [mg109920] Re: data in absolutetime
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sat, 22 May 2010 23:33:37 -0400 (EDT)
On 5/21/10 at 6:44 AM, beatawarchol at gmail.com (Beata ) wrote: >I have list of date for example: >c={20100520,20100519,20100512,20100516,20100430,200100425,20100411, >20100407} in this format. I need get from this list a new list with >the same date but in absolutetime When I use >AbsoluteTime["20100520"], I get this, but I don't know how can I >use it for whole list c The way to achieve this is to use Map. That is: In[2]:= AbsoluteTime[ToString@#] & /@ c Out[2]= {3483302400,3483216000,3482611200,3482956800,3481574400,6314499548755200,3479932800,3479587200} Here, I've used the shorthand way of expressing Map. This could have been done as Map[AbsoluteTime[ToString@#]&, c] or it could be done without using explicit pure functions (the AbsoluteTime[ToString@#]& part) as AbsoluteTime/@(ToString/@c) And to verify the result is what it should be: In[3]:= DateString /@ % Out[3]= {Thu 20 May 2010 00:00:00,Wed 19 May 2010 00:00:00,Wed 12 May 2010 00:00:00,Sun 16 May 2010 00:00:00,Fri 30 Apr 2010 00:00:00,Wed 1 Jan 200100425 00:00:00,Sun 11 Apr 2010 00:00:00,Wed 7 Apr 2010 00:00:00}