| Re: Time conversion [message #23309 is a reply to message #23279] |
Wed, 17 January 2001 09:18   |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Kelly Dean wrote:
>
> I have several NetCDF files with the time listed as seconds since
> 1970-1-1 0:00:00 GMT. Are there any routines in IDL that will convert
> this number to Month, Day, Year, Hour, Minute, and Seconds?
>
> Example: 816134420 ( Nov 12 1995 )
>
> Kelly Dean
> CSU/CIRA
Our timeformat is based on seconds since 2000-01-01 00:00:00 UTC. This
definition
of Julian Seconds was first developed by Ray Sterner (JHUASPL). You
will be able
to use our and Rays formatting routines if you add the offset first to
these numbers.
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_ html/dbase/download/js2string.tar.gz
; NAME:
; js2string
;
; PURPOSE:
; This function converts JulianSeconds to a string, works with array
input
;
; CATEGORY:
; TIME
;
; CALLING SEQUENCE:
; Result= JS2STRING(Julsec)
;
; INPUTS:
; Julsec: double
;
; OUTPUTS:
; Result: string or string array depending input
;
; KEYWORD PARAMETERS:
; YEAR2: 2 digit year
; NO_LEADING_ZERO: no leading zero at all positions
; NOW: returns actual time instead of input time
; FORMAT: string to format the output:
; 'ICG' = 'Y-M-D H:M:S MS'
; 'XLS' = 'D.M.Y H:M:S'
; 'M-D'
; 'H:M'
; 'H:M:S'
; 'Y-M-D'
; 'M-D-Y'
; 'YMDHMS'
;
; EXAMPLE:
; IDL> x= js2string(-12345678D, FORM='y-m-d h:m:s') & PRINT, x
; 1999-08-11 02:38:42
; IDL> x= js2string(-12345678D, FORM='y_m_d_h_m') & PRINT, x
; 1999_08_11_02_38
; IDL> x= js2string(-12345678D, /STR) & HELP, x ,/STR
; ** Structure <f27108>, 8 tags, length=64, refs=1:
; YEAR STRING '1999'
; MONTH STRING '08'
; DAY STRING '11'
; WDAY STRING 'Wednesday'
; HOUR STRING '02'
; MIN STRING '38'
; SEC STRING '42'
; MSEC STRING '000'
For further routines and licensing please look at
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
--
R.Bauer
Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
=============================================
a IDL library at ForschungsZentrum J�lich
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_lib_intro.h tml
http://www.fz-juelich.de/zb/text/publikation/juel3786.html
|
|
|
|