Re: list of dates
- To: mathgroup at smc.vnet.net
- Subject: [mg88379] Re: [mg88334] list of dates
- From: Curtis Osterhoudt <cfo at lanl.gov>
- Date: Sat, 3 May 2008 06:17:56 -0400 (EDT)
- Organization: LANL
- References: <200805020742.DAA05390@smc.vnet.net>
- Reply-to: cfo at lanl.gov
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!
C.O.
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 remove_this.lanl.and_this.gov
PGP Key ID: 0x4DCA2A10
Please avoid sending me Word or PowerPoint attachments
See http://www.gnu.org/philosophy/no-word-attachments.html
==========================================================
- References:
- list of dates
- From: "Roger Nye" <roger.nye@actuary.ch>
- list of dates