Re: Error in function js2ymds (JHU/APL/S1R IDL Lib)? [message #26582] |
Thu, 13 September 2001 10:56 |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Getting date code to work right can be hard. You definitely need to
test things, as you've found out. One gotcha is that Julian days
start at noon, and presumably MS days start at midnight. That in
itself can lead to an apparent offset of 1 day, depending on how you
round the number.
Good luck,
Craig
Olaf Stetzer <olaf.stetzer@imk.fzk.de> writes:
> Hello,
>
> as mentioned in my last posting I want to convert
> Date/Time from Microsoft(Excel)-Format (based on
> 1.1.1900= day 1) into Julian Seconds and then from JS
> into the ODBC-SQL-TIMESTAMP-struct.
>
> For the last conversion I've written a function
> which basically runs js2ymds to get the values
> for y m d and then computes hh mm ss from the
> resulting seconds.
>
> All values are then stored in the aforementioned struct.
>
> I now tried to compute the js from MS-Format and then
> use my function to store this in the sqlstruct:
> ---
> function mstime2sqlts, msdate, mstime
>
> jsdate=(msdate-1)*86400d0-3155673600d0
> js=mstime*86400d0+jsdate
> sqlts=js2sqlts(js)
> return, sqlts
>
> end
> ---
> However I realised that the dates which result from
> my computation differ from the ones that I get when
> I just change the format setting in Excel!
>
> Some Examples:
>
> msdate msdate (formatted) js2ymds
>
> 1 1900 1 1 1900 1 1
> 366 1900 12 31 1901 1 1
> 12481 1934 3 3 1934 3 4
> 36682 2000 6 5 2000 6 6
>
> It seems that in the MS-year 1900 has 1 more day
> compared to the one calculated by js2ymds!! I don't
> know if the fault is in Microsoft Excel or in the
> function js2ymds but maybe in 1900 there was an
> extra switching day (german: Schalttag) which is
> not calculated in the function?
>
> Greetings,
>
> Olaf
>
> --
> Dr. Olaf Stetzer
> Forschungszentrum Karlsruhe
> Institut f�r Meterologie und Klimaforschung
> Atmosph�rische Aerosole (IMK III) - http://imk-aida.fzk.de
> Tel.: +49(0)7247-82-3249 (FAX: -4332)
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|