Re: Dates conversions [message #92259 is a reply to message #92256] |
Thu, 05 November 2015 15:29   |
lucesmm
Messages: 26 Registered: October 2014
|
Junior Member |
|
|
On Thursday, November 5, 2015 at 3:02:49 PM UTC-8, Mike Galloy 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
>>
>
> Yes, convert to Julian days:
>
> IDL> dates = [9.77013, 9.77037, 9.77060, 9.77083, 9.77106, 9.77130,
> 9.77153, 9.77175, 9.77199, 9.77222, 9.77245]
> IDL> jd = julday(8, 5, 2012, 5, 14, 39)
> % Compiled module: JULDAY.
> IDL> jdates = jd + dates
> IDL> caldat, jdates, months, days, years, hours, minutes, seconds
> % Compiled module: CALDAT.
> IDL> print, hours
> 23 23 23 23 23
> 23 23
> 23 23 23 23
> IDL> print, minutes
> 43 43 44 44 44
> 45 45
> 45 46 46 46
> IDL> print, seconds
> 38.245639 58.927402 18.867587 38.725375
> 58.583163
> 19.347323 39.205112 58.238925 18.920688
> 38.778476
> 58.718661
>
> Mike
> --
> Michael Galloy
> www.michaelgalloy.com
> Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Thank you Mike, I was half way there already with the JulDay ... but I didn't know I could just add them up after!
|
|
|