Date formatting
Moderators: chulett, rschirm, roy
Date formatting
hi guyz,
How can I remove the '/' from a date field in a transformation.
thanks
How can I remove the '/' from a date field in a transformation.
thanks
Lots of ways. You could substring it apart around the slashes and put it back together with them. You could use your favorite function like Convert, Ereplace or Change to simply remove them from the field.
Suggest you give Convert a try.
Suggest you give Convert a try.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Unfortunately as there is no OCONV() date format that has no separator, it will always output some sort of character; no OCONV() code will output yyyymmdd or similar formats. You will need to use CONVERT('/','',DateString) to remove forward slashes [or another string function of your choosing]ashwin141 wrote:...simply convert the date from one format to other...
<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:
Oh, there is so too!
Code: Select all
Oconv(internal_date, "D/YMD[4,2,2]" : @VM : "MCN")
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.
But Ray - that is cheating . All the date OCONV()s produce a separator, the use of two conversion formats just "internalizes" the stripping of the characters.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
So... basically the same answer as posted in 2006 with semicolons added to the strip list (it's a date not a date/time) and an unnecessary IConv thrown in for some reason... if you are truly dealing with an internal date. However, if this date has slashes in it then it's already in external format stored in a string so heck - we shouldn't even need the OConv. They did note they didn't need anything converted, just asked how to remove the existing slashes.oracledba wrote:Convert("/:","",Oconv(Iconv(internal_date, "D2/"),"DYMD[4,2,2]"))
Of course, all this is predicated by what Shree0410 meant by a "date field".
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Just wanted to add that the good thing (or perhaps bad thing) about the Conv conversions is that if you do something invalid they typically don't throw an error but rather pass the original value through unchanged. Which is why doing an 'unnecessary' IConv on an internal date seems to work properly.
From what I recall, there is a STATUS function you can call immediately after a conversion call to determine if it was successful or if not, why. Ah yes, here it is:
http://www-01.ibm.com/support/knowledge ... ction.html
Copy/paste the entire URL into your browser.
From what I recall, there is a STATUS function you can call immediately after a conversion call to determine if it was successful or if not, why. Ah yes, here it is:
http://www-01.ibm.com/support/knowledge ... ction.html
Copy/paste the entire URL into your browser.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers