Day of year

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
kcolborn
Premium Member
Premium Member
Posts: 21
Joined: Fri Oct 02, 2009 12:55 pm

Day of year

Post by kcolborn »

I'm trying to convert a date to the format YYddd (day of year). Is there any way to do this inside a transformer? I've been trying different things for a couple of days and can't get anything to work.
gateleys
Premium Member
Premium Member
Posts: 992
Joined: Mon Aug 08, 2005 5:08 pm
Location: USA

Re: Day of year

Post by gateleys »

kcolborn wrote:I'm trying to convert a date to the format YYddd (day of year). Is there any way to do this inside a transformer? I've been trying different things for a couple of days and can't get anything to work.
Assuming your input date is in the format YYYY-MM-DD, try this-

Code: Select all

Oconv(Iconv(InLink.YourDate,"D-YMD[4,2,2]"), "DYW[2,3A]")
gateleys
kcolborn
Premium Member
Premium Member
Posts: 21
Joined: Fri Oct 02, 2009 12:55 pm

Post by kcolborn »

I finally got this one to work:
trim(OCONV(date(),"D2YJ")," ",'A')
Post Reply