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

Home » Public Forums » archive » How to convert Julian date into Gregorian date format in IDL?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
How to convert Julian date into Gregorian date format in IDL? [message #89709] Wed, 19 November 2014 05:34 Go to next message
Muhammad Hasan is currently offline  Muhammad Hasan
Messages: 8
Registered: November 2014
Junior Member
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
Re: How to convert Julian date into Gregorian date format in IDL? [message #89710 is a reply to message #89709] Wed, 19 November 2014 06:22 Go to previous messageGo to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
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
Re: How to convert Julian date into Gregorian date format in IDL? [message #89711 is a reply to message #89709] Wed, 19 November 2014 09:13 Go to previous messageGo to next message
mick.mitanirc3 is currently offline  mick.mitanirc3
Messages: 16
Registered: August 2015
Junior Member
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
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 Go to previous messageGo to next message
David Fanning is currently offline  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 #89714 is a reply to message #89709] Wed, 19 November 2014 10:00 Go to previous messageGo to next message
mick.mitanirc3 is currently offline  mick.mitanirc3
Messages: 16
Registered: August 2015
Junior Member
Dave I can answer that. It's the "Not Invented Here" mentality.

I got away with using the JHU routines because we have associated with them on other projects. While I find your site and these posts to be invaluable resources, the powers that be that I work for control my working environment tightly. We just barely got upgraded to IDL 8.0 this year and that was from 6.1. I'm still trying to get my coworkers to use IDL commands introduced after version 5.3.

If we're lucky we'll see 8.4 in the next year, according to our sys-admin. Maybe we'll be allowed to add in your library when we upgrade IDL.
Re: How to convert Julian date into Gregorian date format in IDL? [message #89715 is a reply to message #89714] Wed, 19 November 2014 10:23 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
mick.mitanirc3@gmail.com writes:

>
> Dave I can answer that. It's the "Not Invented Here" mentality.
>
> I got away with using the JHU routines because we have associated with them on other projects. While I find your site and these posts to be invaluable resources, the powers that be that I work for control my working environment tightly. We just barely got upgraded to IDL 8.0 this year and that was from 6.1. I'm still trying to get my coworkers to use IDL commands introduced after version 5.3.
>
> If we're lucky we'll see 8.4 in the next year, according to our sys-admin. Maybe we'll be allowed to add in your library when we upgrade IDL.

Ah, I can help you write a little program in IDL that changes all the
"cg" file extensions to your initials. You look like a hero and get the
big raise! :-)

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 Go to previous messageGo to next message
Muhammad Hasan is currently offline  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 Go to previous messageGo to next message
Muhammad Hasan is currently offline  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 Go to previous messageGo to next message
Muhammad Hasan is currently offline  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 Go to previous messageGo to next message
Michael Galloy is currently offline  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 #89728 is a reply to message #89709] Thu, 20 November 2014 14:14 Go to previous messageGo to next message
mick.mitanirc3 is currently offline  mick.mitanirc3
Messages: 16
Registered: August 2015
Junior Member
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.
Re: How to convert Julian date into Gregorian date format in IDL? [message #89729 is a reply to message #89728] Thu, 20 November 2014 14:51 Go to previous messageGo to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 11/20/14, 3:14 PM, mick.mitanirc3@gmail.com wrote:
> 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.
>

Ah, got it! I have not heard DOY called a Julian date.

--
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 Go to previous message
David Fanning is currently offline  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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Reversing y-axis using label_date
Next Topic: gray-level co-occurrence matrix (GLCM)

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

Current Time: Wed Oct 08 15:07:52 PDT 2025

Total time taken to generate the page: 0.00646 seconds