Type conversion not recognized
Moderators: chulett, rschirm, roy
Type conversion not recognized
Hi when i try to convert a string to date from a transformer stage it shows the derivation as red in color even when i used the same format as IBM indicated StringToDate(string,Format). Can any one tell the solution.
Rockzz Tech
[quote="chulett"][i]StringToDate()[/i] is a [b]PX[/b] function so no good in a Server job. For that you'll probably need the IConv/OConv tag team but that can depend on what you mean by "date". What's your target? ...[/quote]
Craig,
I want to extract any format of date such as (timestamp, sybase datatime) to a date(yyyy-mm-dd) I tried to extract the first top ten position of the value of that column but it results in string. So to adjust it into the date. i need the conversion. Or if any other solution please let me know.
Craig,
I want to extract any format of date such as (timestamp, sybase datatime) to a date(yyyy-mm-dd) I tried to extract the first top ten position of the value of that column but it results in string. So to adjust it into the date. i need the conversion. Or if any other solution please let me know.
Rockzz Tech
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Everything in server jobs is a string. The fact that you can use these strings to load into databases is a bonus - but that's precisely what you are doing with manually-entered SQL after all.
Thus the easiest way to get a date from a timestamp is to extract the first 10 characters.
Thus the easiest way to get a date from a timestamp is to extract the first 10 characters.
Code: Select all
Left(InLink.TheTimestamp, 10)
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.
[quote="ray.wurlod"]Everything in server jobs is a string. The fact that you can use these strings to load into databases is a bonus - but that's precisely what you are doing with manually-entered SQL after all.
Thus ...[/quote]
Just for an effective straight forward question:
How to convert the string "1999-01-01 10:30:50" to Date "1999-01-01" in server job.
I used Oconv(Iconv("1999-01-01 10:30:50"),"DMYD"),"D-YMD"). And the source is of String type and target is Date.
Thus ...[/quote]
Just for an effective straight forward question:
How to convert the string "1999-01-01 10:30:50" to Date "1999-01-01" in server job.
I used Oconv(Iconv("1999-01-01 10:30:50"),"DMYD"),"D-YMD"). And the source is of String type and target is Date.
Rockzz Tech
And you got an 'effective straight forward' answer in Ray's post.
OK... first you need to ensure that you really need something in an external YYYY-MM-DD format for your date target. And since your source is already in that format (it just has some extra bits) if that's really what you need then there's no need to "convert" anything. Simply take the first 10 characters (or the first 'field') using whatever technique floats your boat.
If you are going to quote people and otherwise use the tags the forum software supports, you cannot check/enable the 'Disable BBCode in this post' option. FYI.
![Confused :?](./images/smilies/icon_confused.gif)
OK... first you need to ensure that you really need something in an external YYYY-MM-DD format for your date target. And since your source is already in that format (it just has some extra bits) if that's really what you need then there's no need to "convert" anything. Simply take the first 10 characters (or the first 'field') using whatever technique floats your boat.
![Idea :idea:](./images/smilies/icon_idea.gif)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers