Re: list of dates
- To: mathgroup at smc.vnet.net
- Subject: [mg88360] Re: [mg88334] list of dates
- From: Carl Woll <carlw at wolfram.com>
- Date: Sat, 3 May 2008 06:14:31 -0400 (EDT)
- References: <200805020742.DAA05390@smc.vnet.net>
Roger Nye wrote:
>Hi,
>I have a list of dates in the format YYYY-MM-DD and I want to convert them
>to a decimal value, so 1963-01-01 goes to 63.0 and 1985-07-01 goes roughly
>to 85.5.
>
>Any suggestions on the best way to do this?
>
>Many thanks
>Roger
>
>
>
Perhaps Developer`CalendarData may help:
In[102]:= Developer`CalendarData[{1985, 7, 1}, "TimeInYear"]
Out[102]= 0.49589
An alternative is to use DateDifference:
In[103]:= DateDifference[{1985, 1, 1}, {1985, 7, 1}, "Year"]
Out[103]= {0.49589,Year}
Carl Woll
Wolfram Research
- References:
- list of dates
- From: "Roger Nye" <roger.nye@actuary.ch>
- list of dates