|
|
|
Re: How to convert Julian date into Gregorian date format in IDL? [message #89712 is a reply to message #89711] |
Wed, 19 November 2014 09:33   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
mick.mitanirc3@gmail.com writes:
>
> On Wednesday, November 19, 2014 7:34:46 AM UTC-6, Muhammad Hasan wrote:
>> Hi All!
>> I have a little problem in IDL. How to calculate Gregorian date in IDL from Julian date? For example I have Julian date 335 and I want to get yyyymmdd format. How to get it?
>>
>> Regards,
>>
>> Hasan
>
> While systime works great for today, when I am working with other julian day values and need to convert them I use the JD2DATE program. Originally from John Hopkins it can be found at Exelis along with many other JHU/APL routines. Check out http://www.exelisvis.com/docs/jd2date.html
If you have the Coyote Library installed (I why wouldn't you?), you can
used cgJulian2Date to do this, too. There are 21 different data formats
you can choose to use.
http://www.idlcoyote.com/idldoc/cg/cgjulian2date.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
|
|
Re: How to convert Julian date into Gregorian date format in IDL? [message #89722 is a reply to message #89710] |
Thu, 20 November 2014 01:28   |
Muhammad Hasan
Messages: 8 Registered: November 2014
|
Junior Member |
|
|
On Wednesday, November 19, 2014 10:22:09 PM UTC+8, Mike Galloy wrote:
> On 11/19/14, 6:34 am, Muhammad Hasan wrote:
>> Hi All! I have a little problem in IDL. How to calculate Gregorian
>> date in IDL from Julian date? For example I have Julian date 335 and
>> I want to get yyyymmdd format. How to get it?
>>
>> Regards,
>>
>> Hasan
>>
>
> IDL> julday = systime(/julian)
> IDL> print, string(julday, format='(C(CYI04, CMOI02, CDI02))')
> 20141119
>
> --
> Michael Galloy
> www.michaelgalloy.com
> Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
> Research Mathematician
> Tech-X Corporation
Thanks a lot dear Dr. Galloy. You mean it will convert my julian date 213 for 2010 into August 1, 2010?
Regards,
|
|
|
Re: How to convert Julian date into Gregorian date format in IDL? [message #89723 is a reply to message #89712] |
Thu, 20 November 2014 01:29   |
Muhammad Hasan
Messages: 8 Registered: November 2014
|
Junior Member |
|
|
On Thursday, November 20, 2014 1:33:03 AM UTC+8, David Fanning wrote:
> mick.mitanirc3@gmail.com writes:
>
>>
>> On Wednesday, November 19, 2014 7:34:46 AM UTC-6, Muhammad Hasan wrote:
>>> Hi All!
>>> I have a little problem in IDL. How to calculate Gregorian date in IDL from Julian date? For example I have Julian date 335 and I want to get yyyymmdd format. How to get it?
>>>
>>> Regards,
>>>
>>> Hasan
>>
>> While systime works great for today, when I am working with other julian day values and need to convert them I use the JD2DATE program. Originally from John Hopkins it can be found at Exelis along with many other JHU/APL routines. Check out http://www.exelisvis.com/docs/jd2date.html
>
> If you have the Coyote Library installed (I why wouldn't you?), you can
> used cgJulian2Date to do this, too. There are 21 different data formats
> you can choose to use.
>
> http://www.idlcoyote.com/idldoc/cg/cgjulian2date.html
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Thanks Dr. Fanning.
Regards,
|
|
|
Re: How to convert Julian date into Gregorian date format in IDL? [message #89724 is a reply to message #89711] |
Thu, 20 November 2014 01:31   |
Muhammad Hasan
Messages: 8 Registered: November 2014
|
Junior Member |
|
|
On Thursday, November 20, 2014 1:13:07 AM UTC+8, mick.mi...@gmail.com wrote:
> On Wednesday, November 19, 2014 7:34:46 AM UTC-6, Muhammad Hasan wrote:
>> Hi All!
>> I have a little problem in IDL. How to calculate Gregorian date in IDL from Julian date? For example I have Julian date 335 and I want to get yyyymmdd format. How to get it?
>>
>> Regards,
>>
>> Hasan
>
> While systime works great for today, when I am working with other julian day values and need to convert them I use the JD2DATE program. Originally from John Hopkins it can be found at Exelis along with many other JHU/APL routines. Check out http://www.exelisvis.com/docs/jd2date.html
Thanks a lot.
Regards,
|
|
|
Re: How to convert Julian date into Gregorian date format in IDL? [message #89727 is a reply to message #89722] |
Thu, 20 November 2014 10:21   |
Michael Galloy
Messages: 1114 Registered: April 2006
|
Senior Member |
|
|
On 11/20/14, 2:28 AM, Muhammad Hasan wrote:
> On Wednesday, November 19, 2014 10:22:09 PM UTC+8, Mike Galloy wrote:
>> On 11/19/14, 6:34 am, Muhammad Hasan wrote:
>>> Hi All! I have a little problem in IDL. How to calculate Gregorian
>>> date in IDL from Julian date? For example I have Julian date 335 and
>>> I want to get yyyymmdd format. How to get it?
>>>
>>> Regards,
>>>
>>> Hasan
>>>
>>
>> IDL> julday = systime(/julian)
>> IDL> print, string(julday, format='(C(CYI04, CMOI02, CDI02))')
>> 20141119
>>
>> --
>> Michael Galloy
>> www.michaelgalloy.com
>> Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
>> Research Mathematician
>> Tech-X Corporation
>
> Thanks a lot dear Dr. Galloy. You mean it will convert my julian date 213 for 2010 into August 1, 2010?
>
> Regards,
>
I did that calculation on November 19, 2014, which it converted to
20141119 (YYYYMMDD, which I thought was the format you wanted?). I just
used today's date because it was the easiest way to get a Julian date.
Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Research Mathematician
Tech-X Corporation
|
|
|
|
|
Re: How to convert Julian date into Gregorian date format in IDL? [message #89730 is a reply to message #89728] |
Thu, 20 November 2014 14:59  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
mick.mitanirc3@gmail.com writes:
>
> I think the disconnect here is between Julian Date and Julian Day of Year (DOY).
>
> Mr. Hasan's value of 213 is a Julian Day of Year value, in this case 213 days into year 2010. Systime with the /Julian flag returns the Julian Date value - the number of seconds elapsed since 00:00:00 Jan 1 1970 UTC (commonly called the Unix or POSIX Epoch).
>
> The military often use Julian DOY in the form of YYYYDOY or YYDOY and unfortunately usually call the result a Julian Date which wasn't a problem until us programmers came around with our date/time functions.
>
> The JHU library function I mentioned in my first reply works with Julian DOY.
I just want to point out that the built-in Julday function (in
conjunction with CalDat) can also handle the Day of Year number.
IDL> date = 2007118L
IDL> year = Fix(StrMid(StrTrim(date,2), 0, 4))
IDL> dayofyear = Fix(StrMid(StrTrim(date,2), 4, 3))
IDL> CALDAT, JULDAY(1, dayofyear, year), month, day
IDL> Print, month, day
4 28
You can learn more here:
http://www.idlcoyote.com/code_tips/dayofyear.html
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|