Re: dates transformation [message #39898] |
Tue, 15 June 2004 04:43 |
Thomas Ohde
Messages: 10 Registered: November 2000
|
Junior Member |
|
|
"Thomas Ohde" <thomas.ohde@io-warnemuende.de> schrieb im Newsbeitrag
news:40ce8f97$1@news.uni-rostock.de...
> Hi,
>
> I have given dates like 38141.497920 and I can transform this with Excel
> into: 03.06.2004 11:57. I found in the help that this is the 1900 date
> format.
>
> How can I transform these dates in both direction with IDL? Is there any
> function in IDL?
>
>
> Thanks a lot,
> Thomas
>
>
I have found a further solution.
How about this:
IDL> excel = 38141.49792d
IDL> caldat, 2415018.5 + excel,month,day,year,hour,min,sec
IDL> print, month,day,year,hour,min,sec
6 3 2004 11 57 0.28799951
Thomas
|
|
|
Re: dates transformation [message #39899 is a reply to message #39898] |
Tue, 15 June 2004 03:12  |
tam
Messages: 48 Registered: February 2000
|
Member |
|
|
"Thomas Ohde" <thomas.ohde@io-warnemuende.de> wrote in message news:<40ce8f97$1@news.uni-rostock.de>...
> Hi,
>
> I have given dates like 38141.497920 and I can transform this with Excel
> into: 03.06.2004 11:57. I found in the help that this is the 1900 date
> format.
>
> How can I transform these dates in both direction with IDL? Is there any
> function in IDL?
>
>
> Thanks a lot,
> Thomas
Take a look at the JULDATE, JDCNV and DAYCNV routines in the idlastro library
at idlastro.gsfc.nasa.gov. These do pretty much what you want except
that they have a different zero point. You'll have to add or subtract
a constant offset to get 0 to be 1900.000.
Regards,
Tom McGlynn
|
|
|
Re: dates transformation [message #39901 is a reply to message #39899] |
Tue, 15 June 2004 00:44  |
Chris Lee
Messages: 101 Registered: August 2003
|
Senior Member |
|
|
In article <40ce8f97$1@news.uni-rostock.de>, "Thomas Ohde"
<thomas.ohde@io-warnemuende.de> wrote:
> Hi,
> I have given dates like 38141.497920 and I can transform this with
> Excel into: 03.06.2004 11:57. I found in the help that this is the 1900
> date format.
> How can I transform these dates in both direction with IDL? Is there any
> function in IDL?
> Thanks a lot,
> Thomas
>
str = SYSTIME(0,TIME_IN_SECONDS,/utc)
will return a string of the time, where TIME_IN_SECONDS is the number of
seconds from 1970 Jan 1 UTC.
How you convert to 1970/1/1 0:0:0 utc is another thing. The excel format
is, I think. The number of days since 1900..eg
38141.497920 = 104 years + 181 days etc...
If you (naivly) subtract 70*365 days and then multiply by 86400. .
seconds(per day), then you get
Tue Jun 22 11:57:00 2004
Which is almost right, it's out by 18 days, which is the number
of leap days in the 1900-1974 range.
so...
excel=38141.497920D
str=systime(0,(excel-(365*70+18.))*86400.,/utc)
Converting the other way is more...tedious, bin_date, caldate, julday are
your friends, and a bit of strpos/stregex
Chris
|
|
|