Conversion of JulianDate YYDDD to mm/dd/yy date format

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
vish08
Premium Member
Premium Member
Posts: 16
Joined: Mon May 12, 2008 8:45 am

Conversion of JulianDate YYDDD to mm/dd/yy date format

Post by vish08 »

In DB2, the julian date is 94167 defined as Decimal. I need to convert this into 06/16/94.
Tried DateFromJulianDay function but getting ***
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That's not a Julian date but rather an Ordinal date, meaning the first two digits are the year and the next three are the day number for that year. From the manual:

"A Julian day specifies the date as the number of days from 4713 BCE January 1, 12:00 hours (noon) GMT"

In other words, just an integer. Sorry, not sure off the top of my head if there's a PX function to handle those kind of date fields or if you need to sub-string it and handle the pieces separately.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mrajesh99
Participant
Posts: 8
Joined: Sat Aug 01, 2009 11:37 pm

Re: Conversion of JulianDate YYDDD to mm/dd/yy date format

Post by mrajesh99 »

hi,
i think you can change it to date by using date_from_string function and specify the Date format as yyddd. you have to convert decimal to string first which can be achieved by using DecimalToString(CollName,"suppress_zero").
mrajesh99
Participant
Posts: 8
Joined: Sat Aug 01, 2009 11:37 pm

Re: Conversion of JulianDate YYDDD to mm/dd/yy date format

Post by mrajesh99 »

hi,
i think you can change it to date by using date_from_string function and specify the Date format as yyddd. you have to convert decimal to string first which can be achieved by using DecimalToString(CollName,"suppress_zero").

It Looks Similar to this

StringToDate(DecimalToString(Link_AU.AU_ID,"suppress_zero"),"%yy%ddd")
harshada
Premium Member
Premium Member
Posts: 92
Joined: Tue May 29, 2007 8:40 am

Post by harshada »

hi,

Try using StringToDate(Trim(INP_DATE),"%yyyy%ddd")

~
Harshada..
Post Reply