date from month -int (4)

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
ovidiu
Premium Member
Premium Member
Posts: 22
Joined: Tue Dec 20, 2005 7:14 pm

date from month -int (4)

Post by ovidiu »

Does anybody know a simple method to get a date- month.year-from a number month int(4)

Thank you
ovidiu
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

There is no single builtin function in PX to let you do this. You will need to convert your Month number (based on what first month?) into an actual date and then use the [bold]DateFromDaysSince[/bold] to get a number of date using a average of 30 days/month, or use 29 and accept a possible error on rounding down if there are more than 31 months between the two dates. Correct would be to write your own offset math working on the yy and mm initial values, adding your months and wrapping after month 12 and adding 1 to the year. Finally, putting the new yy and mm values together with a day of 1 to get a value which can be converted to date format.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Convert the number to a string, add a day number (such as "01") in the appropriate location for your date format, then use a string to date conversion function.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ovidiu
Premium Member
Premium Member
Posts: 22
Joined: Tue Dec 20, 2005 7:14 pm

Post by ovidiu »

Thanks for the answers...I just found a string date to relate to ...but is good to know.
Thanks again
ovidiu
Post Reply