Hi
I am trying to convert date from yyyy/dd/mm to mm/dd/yyyy
I was also trying to convert the timestamp to dd/mm/yyyy.
I am not able to converte it. Can anyone tell what should i do?
vaishali [/code]
Date Conversion
Moderators: chulett, rschirm, roy
Search this forum for the oft covered ICONV and OCONV functions, as well has how to use substring notation ( variable[x,y] ) and FIELD functions to parse dates.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You may find the article Date Conversion Demystified useful too.
Beware that some stage types convert the date into DataStage internal format (an integer), while other stage types don't. You did not specify which stage type you are using.
Basically, though, if the dates are arriving as character strings, then you can use character string manipulation (substring and concatenation) to rearrange the characters. For example:
A similar technique can be used if the source date is a timestamp.
Alternately you can convert the source date into internal format (if DataStage has not done so already), then back into an appropriate external format. The former uses the Iconv() function, the latter uses the Oconv() function. For example:
Beware that some stage types convert the date into DataStage internal format (an integer), while other stage types don't. You did not specify which stage type you are using.
Basically, though, if the dates are arriving as character strings, then you can use character string manipulation (substring and concatenation) to rearrange the characters. For example:
Code: Select all
TheDate[9,2] : "/" : TheDate[6,2] : "/" : TheDate[1,4]
Alternately you can convert the source date into internal format (if DataStage has not done so already), then back into an appropriate external format. The former uses the Iconv() function, the latter uses the Oconv() function. For example:
Code: Select all
Oconv(Iconv(TheDate, "DYMD"), "D/MDY[2,2,4]")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.