Converting M/DD/YYYY to YYYY-MM-DD
Moderators: chulett, rschirm, roy
Converting M/DD/YYYY to YYYY-MM-DD
Hi,
I need to convert a date format from M/DD/YYYY to YYYY-MM-DD. Is there any easy way of doing it in datastage?
Eg: If my input date is 7/15/2000, output should be 2000-15-07
If input date is 7/7/2000, output should be 2000-07-07
Thanking you in advance...
sue
I need to convert a date format from M/DD/YYYY to YYYY-MM-DD. Is there any easy way of doing it in datastage?
Eg: If my input date is 7/15/2000, output should be 2000-15-07
If input date is 7/7/2000, output should be 2000-07-07
Thanking you in advance...
sue
Re: Converting M/DD/YYYY to YYYY-MM-DD
Hi,
For DS Server version use iconv and oconv functions to convert date to different formats
For syntax check the forum or the pdf
Regards
Wah
For DS Server version use iconv and oconv functions to convert date to different formats
For syntax check the forum or the pdf
Regards
Wah
Re: Converting M/DD/YYYY to YYYY-MM-DD
Hi,
You can Use Iconv and Oconv Functions as :
Trim(Oconv(Iconv(LinkName.DateColumn,"D-YMD[4,2,2]"),"DYMD[4,2,2]")," ","A")
This will give you the desired output. "InputDate" is the date in
YYYY-MM-DD Format.
You can Use Iconv and Oconv Functions as :
Trim(Oconv(Iconv(LinkName.DateColumn,"D-YMD[4,2,2]"),"DYMD[4,2,2]")," ","A")
This will give you the desired output. "InputDate" is the date in
YYYY-MM-DD Format.
Regards,
Abburi
Abburi
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
Oconv(Iconv(InLink.TheDate, "DMDY"), "D-YMD[4,2,2]")
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.
Hmmm... while it may work, the 4 in "D4" isn't needed and (as noted in the documentation) the 'modifiers' of '[2,2,4]' and the delimiter are for output only and are ignored on input. So, suprisingly, all that was needed was exactly what Ray posted.
-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:
The syntax of the 'D' conversion code is fully documented in the online help. From the help Index, type a "D" and that should take you right to D code [BASIC] where the syntax is explained along with a number of examples.
You can also get there from the OConv or IConv topics.
You can also get there from the OConv or IConv topics.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers