Hi,
please advice i have date in varchar want to change in Timestamp
12-oct-2004(varchar) to 2004-10-12 00:00:00 (Timestamp)
Thanks,
Bobby
date conversion plz advice
Moderators: chulett, rschirm, roy
Hello Bobby,
you could use OCONV(ICONV(In.Date,"D4-DMY"),"D4-YMD[4,2,2]"):" 00:00:00". This will work for your sample but of course doesn't do any error checking in case the input date has an invalid format.
you could use OCONV(ICONV(In.Date,"D4-DMY"),"D4-YMD[4,2,2]"):" 00:00:00". This will work for your sample but of course doesn't do any error checking in case the input date has an invalid format.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Spend some time learning about DataStage's date conversion functions. The paper Date Conversion Demystified is a good place to start.
Search the Forum; there are answers to your exact requirement to be found. Essentially you convert the incoming date into DataStage internal format, then convert that into exactly the output format you require. Add the time component using string concatenation.
Search the Forum; there are answers to your exact requirement to be found. Essentially you convert the incoming date into DataStage internal format, then convert that into exactly the output format you require. Add the time component using string concatenation.
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: 7
- Joined: Wed Nov 03, 2004 6:11 am
Re: date conversion plz advice
You can also change this date field to timestamp using an user defined SQL (if your source is a database). Else better to use ICONV and OCONV.
bobby wrote:Hi,
please advice i have date in varchar want to change in Timestamp
12-oct-2004(varchar) to 2004-10-12 00:00:00 (Timestamp)
Thanks,
Bobby