MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to convert julian date to a date displayable

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Wed Mar 22, 2006 3:57 pm    Post subject: how to convert julian date to a date displayable Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Mar 22, 2006 4:17 pm    Post subject: Reply with quote

shekar123,

Please search before posting. check this link which explains in detail about julian dates evaluation and their usage

http://www.mvsforums.com/helpboards/viewtopic.php?t=4195&highlight=julian

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Wed Mar 22, 2006 9:49 pm    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Mar 23, 2006 5:57 am    Post subject: Reply with quote

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
Code:

2006-03-23


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Thu Mar 23, 2006 7:25 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Mar 23, 2006 7:52 am    Post subject: Reply with quote

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

Code:

CCYY/DDD


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Fri Mar 24, 2006 5:19 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Fri Mar 24, 2006 7:01 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group