Date format (last day of previous month)

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
srini.dw
Premium Member
Premium Member
Posts: 186
Joined: Fri Aug 18, 2006 1:59 am
Location: Chennai

Date format (last day of previous month)

Post by srini.dw »

Iam using DataStage 7.5 PX version, I have date coming as 2007-03-02, i need to convert to 2007-02-28 i.e., last day of the previous month, whenever i run the job, can we do it in a single line i.,e i.,e Transformer.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Care to share the workaround?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
dsdev750
Charter Member
Charter Member
Posts: 16
Joined: Sat Jun 04, 2005 10:19 am

Post by dsdev750 »

Since you want to do it in one line,

DateFromDaysSince(-1, StringToDate(DateToString(DSLink2.col1, "%yyyy-%mm-%dd")[1,8] : '01', "%yyyy-%mm-%dd"))
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Or, slightly simpler:

Code: Select all

DateFromDaysSince(-1, StringToDate(DateToString(DSLink2.col1, "%yyyy-%mm") : '-01', "%yyyy-%mm-%dd")) 
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
srini.dw
Premium Member
Premium Member
Posts: 186
Joined: Fri Aug 18, 2006 1:59 am
Location: Chennai

Re: Date format (last day of previous month)

Post by srini.dw »

Its working, thank you
Post Reply