comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Dates conversions
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Dates conversions [message #92257 is a reply to message #92255] Thu, 05 November 2015 15:08 Go to previous messageGo to previous message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
On Thursday, 5 November 2015 10:47:30 UTC-8, luc...@gmail.com wrote:
> Hello I have a problem and I am trying to see if IDL can solve this
>
> I have an initial date
> 08/05/2012 05:14:39
>
> and then my data is arrange in days and fractions of days
> DAY
> 9.77013 -> meaning 9.77013 days after the initial date
> 9.77037
> 9.77060
> 9.77083
> 9.77106
> 9.77130
> 9.77153
> 9.77175
> 9.77199
> 9.77222
> 9.77245
>
> is there a way that IDL can help me to convert each point to real date and time given the start date and time ?
>
>
> Thanks

This should do it.

d0Str = '08/05/2012 05:14:39'

;; Assuming mm/dd/yyyy: correct?

d0Jul = 0.0D ; Initialize to Double for millisecond accuracy
ReadS, d0Str, d0Jul, $
Format='(C(CMOI2,X,CDI2,X,CYI4,X,CHI2,X,CMI2,X,CSI2))'

dOffsets = [9.77013, 9.77037, 9.77060, 9.77083, 9.77106, 9.77130, 9.77153, $
9.77175, 9.77199, 9.77222, 9.77245]

dJuls = d0Jul + dOffsets

Print, [d0Jul, dJuls], $
Format='(C(CMOI2.2,"/",CDI2.2,"/",CYI4.4,X,CHI2.2,":",CMI2.2, ":",CSI2.2))'


For output, I get:

08/05/2012 05:14:39
08/14/2012 23:43:38
08/14/2012 23:43:58
08/14/2012 23:44:18
08/14/2012 23:44:38
08/14/2012 23:44:58
08/14/2012 23:45:19
08/14/2012 23:45:39
08/14/2012 23:45:58
08/14/2012 23:46:18
08/14/2012 23:46:38
08/14/2012 23:46:58

Those are truncated seconds, by the way. For more precision (which may be illusory):

Print, [d0Jul, dJuls], $
Format='(C(CMOI2.2,"/",CDI2.2,"/",CYI4.4,X,CHI2.2,":",CMI2.2, ":",CSF6.3))'

08/05/2012 05:14:39.000
08/14/2012 23:43:38.232
08/14/2012 23:43:58.968
08/14/2012 23:44:18.840
08/14/2012 23:44:38.712
08/14/2012 23:44:58.584
08/14/2012 23:45:19.320
08/14/2012 23:45:39.192
08/14/2012 23:45:58.200
08/14/2012 23:46:18.936
08/14/2012 23:46:38.808
08/14/2012 23:46:58.680

Dick Jackson Software Consulting Inc.
Victoria, BC, Canada --- http://www.d-jackson.com
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: correlation question
Next Topic: testing IDL_IDLBridge status

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:57:59 PDT 2025

Total time taken to generate the page: 0.00347 seconds