View previous topic :: View next topic |
Author |
Message |
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Wed Mar 22, 2006 3:57 pm Post subject: how to convert julian date to a date displayable |
|
|
Hai All,
I have a requirement which says to convert the julian date to a date readable in the format mm-dd-ccyy for a report.How can be this done and i do not know any thing about Julian dates .Why do we use Julian dates when we have DB2 date facility.Can anybody help me out in this requirement and any sample example showing the real usage of Julian date and how to convert julian date to the date format would really be helpful.
Is there any particular significance of using Julian date when we have inbuilt DB2 date functions available ? _________________ Shekar
Grow Technically |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Wed Mar 22, 2006 9:49 pm Post subject: |
|
|
Koulsu,
Thanks for the link provided and it has a very good information of Julian dates.Can i have a small sample example to convert the Julian date to a date in the format mm-dd-ccyy as it would really help me out in understanding. _________________ Shekar
Grow Technically |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu Mar 23, 2006 5:57 am Post subject: |
|
|
shekar123,
simple the julian date equivalent of march 23rd 2006 is
2006082
where 2006 is the current year and 082 is the day of the year
Code: |
SELECT DATE('2006082')
FROM SYSIBM.SYSDUMMY1;
|
will give you
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Thu Mar 23, 2006 7:25 am Post subject: |
|
|
Kolusu,
Thanks for your reply and i now clear with the example provided by you.I have a requirement where i have to convert julian date to yyyy-mm-dd format.
Julain start date as PIC X(05) value is '03/05'.
Julian end date as PIC X(05) value is '/0407'.
I am assuming the values in yyyy-mm-dd format to be as below.Please correct me if i am wrong.
03/05 -------------------- 2003-01-05
/0407 -------------------- 2004-01-07 _________________ Shekar
Grow Technically |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu Mar 23, 2006 7:52 am Post subject: |
|
|
Quote: |
Julain start date as PIC X(05) value is '03/05'.
Julian end date as PIC X(05) value is '/0407'.
I am assuming the values in yyyy-mm-dd format to be as below.Please correct me if i am wrong.
|
shekar123,
I really cannot comment on that . How do you differentiate between the year portion and day of the year portion ?
Also what happens if the day of the year is more than 100 ? ie some date in april. Your julian date can only fit 2 digit numbers for the day of the year.
Ideally I would define
Code: |
Julain start date as PIC X(08)
|
to store
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Fri Mar 24, 2006 5:19 am Post subject: |
|
|
Hai Kolusu,
Thanks for making me clear in my understanding and Is there any function available which converts the julian date to a db2 date format as i need to convert the Julian date into db2 date in my program and make use of it further ahead ?
To incorporate this , if we do not have any fucntion avaiable , what would be logic be to convert julian Date to DB2 date. _________________ Shekar
Grow Technically |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Fri Mar 24, 2006 7:01 am Post subject: |
|
|
Quote: |
Is there any function available which converts the julian date to a db2 date format as i need to convert the Julian date into db2 date in my program and make use of it further ahead ?
To incorporate this , if we do not have any fucntion avaiable , what would be logic be to convert julian Date to DB2 date.
|
Shekhar123,
I don't understand. I already answered the same question 3 post above and yet you come back and ask the same question once again.
Read the answers carefully once again
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
|
|