MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: list of dates

Hi, Roger, 

    If the dates you have are in the form of strings (or you can get them that 
way), you might take advantage of the DateList and AbsoluteTime functions. 
Here's an example:

 (*  more dates added so the problem isn't as trivial*)
 dates = Sort@{"1963-01-01", "1900-01-01", "2007-04-04", "1886-05-19", 
   "1985-07-01", "1977-09-28"}

(* take the dates, turn them into Mathematica's standard 
form, and then get parse into seconds form to be able to use Rescale 
in the next step *)
absTimes = AbsoluteTime /@ DateList /@ dates

(* finally perform the rescaling *)
Rescale[absTimes, {1988064000, 2698012800}, {63.0, 85.5}]

           Hope that helps!

On Friday 02 May 2008 01:42:23 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

Curtis Osterhoudt
cfo at
PGP Key ID: 0x4DCA2A10
Please avoid sending me Word or PowerPoint attachments

  • Prev by Date: Re: DSolve Issues
  • Next by Date: Re: DSolve Issues
  • Previous by thread: Re: list of dates
  • Next by thread: Re: list of dates