convert string to date
Moderators: chulett, rschirm, roy
convert string to date
Hi,
my input is a string (123179) which needs to be converted to date type.
I tried using iconv and oconv but am still getting date conversion error.
Can someone help me with this..
Thanks,
Krishna.
my input is a string (123179) which needs to be converted to date type.
I tried using iconv and oconv but am still getting date conversion error.
Can someone help me with this..
Thanks,
Krishna.
But it complains that the source is in MM/DD/YY format. What is your target stage?
Use to convert it into Date fromate from String. If it is a database stage, you can use To_date() that avaialble in database SQL statement.
Use
Code: Select all
Iconv("Link.Date", "D2/")
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Have you tried Iconv("Link.Input", "DYMD[2,2,2]")?
Or you can even try the same previous option by concatinating "/" in middle. StageVariable = Link.Input[1,2]:"/":Link.Input[3,2]:"/":Link.Input[5,2], and use this stage variable for conversion.
Or you can even try the same previous option by concatinating "/" in middle. StageVariable = Link.Input[1,2]:"/":Link.Input[3,2]:"/":Link.Input[5,2], and use this stage variable for conversion.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Kumar's suggestion of using a ICONV(In.Col,'D2MDY[2,2,2]') will work, as will manually creating a string with separators and then ICONving it.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
ArndW is right. That option will work.
You can also try
You can also try
Code: Select all
OCONV(ICONV(in.date,"DMDY[2,2,2]":@VM:"MCN"),"D/MDY[2,2,2]")
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
I am sure,
for testing purposes just create a simple routine with one arg and paste either mine or kumar's solution there. Test it there. You will see that they both work.
Try loading it to a sequential file. What database are you loading it too.
For most databases, the date format is YYYY-MM-DD
Try this
for testing purposes just create a simple routine with one arg and paste either mine or kumar's solution there. Test it there. You will see that they both work.
Try loading it to a sequential file. What database are you loading it too.
For most databases, the date format is YYYY-MM-DD
Try this
Code: Select all
OCONV(ICONV(in.date,"DMDY[2,2,2]":@VM:"MCN"),"D-YMD[4,2,2]")
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
All too complex. To convert to an internal date all that is needed is
Code: Select all
Iconv(InLink.TheDate, "DMDY")
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.