Page 1 of 1

Date format (last day of previous month)

Posted: Thu Feb 08, 2007 9:57 am
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.

Posted: Thu Feb 08, 2007 10:09 am
by DSguru2B
Care to share the workaround?

Posted: Thu Feb 08, 2007 10:55 am
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"))

Posted: Thu Feb 08, 2007 3:13 pm
by ray.wurlod
Or, slightly simpler:

Code: Select all

DateFromDaysSince(-1, StringToDate(DateToString(DSLink2.col1, "%yyyy-%mm") : '-01', "%yyyy-%mm-%dd")) 

Re: Date format (last day of previous month)

Posted: Thu Feb 08, 2007 10:14 pm
by srini.dw
Its working, thank you