All,
Need a help in date conversion. I searched quite a bit but could not find the specific conversion function.
My input is from DB2 and data type is DATE which is YYYY-MM-DD for format. The output is in sequential file (.txt) and it needs to be MM/DD/YYYY format.
I used the below function, but not working.
Oconv(Iconv(As_Of_Dt,"D-MDY[2,2,4]","D/MDY[2,2,4]")
Any help.
Thanks.
Date Conversion (YYYY-MM-DD to MM-DD-YYYY)
Moderators: chulett, rschirm, roy
Hopefully your target field is a string. True DATE data types are just an internal number and thus have no format so I do believe you can skip the IConv and try it with the OConv alone. Either that or leverage whatever DB2 uses for a "to char" function directly in the source SQL.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
If the source is in YMD order, then your Iconv() function must also specify YMD order. Yours specifies MDY order.
Try
Try
Code: Select all
Oconv(Iconv(InLink.TheDate, "DYMD"), "D/MDY[2,2,4]")
Last edited by ray.wurlod on Mon Nov 17, 2014 11:49 pm, edited 1 time in total.
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.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
See also Date Conversion Demystified
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.