converting string to timestamp
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 48
- Joined: Fri Feb 29, 2008 1:09 am
- Location: Bangalore
converting string to timestamp
Hi All,
In my project we use DB2 as source,I am loading data into a dataset which is having field with decimal type.I am converting this to timestamp
using 2 step conversion first convertnig decimal to string and again converting that string to timestamp.when i am converting string to timestamp its returing *** in the output.
I any one have answer plz let me know
In my project we use DB2 as source,I am loading data into a dataset which is having field with decimal type.I am converting this to timestamp
using 2 step conversion first convertnig decimal to string and again converting that string to timestamp.when i am converting string to timestamp its returing *** in the output.
I any one have answer plz let me know
Thanks&Regards
S.Swathi
S.Swathi
-
- Participant
- Posts: 48
- Joined: Fri Feb 29, 2008 1:09 am
- Location: Bangalore
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 48
- Joined: Fri Feb 29, 2008 1:09 am
- Location: Bangalore
Hello
I am posting the derivations ,
I want to convert the out_data.Duration from decimal to timestamp.
I am doing first conversion in stage variable
svr (stage variable)----> DecimalToString(out_data.Duration)
second conversion(string to timestamp) derivation is
StringToTimestamp(svr,'%yyyy-%mm-%dd %hh:%nn:%ss')
I am posting the derivations ,
I want to convert the out_data.Duration from decimal to timestamp.
I am doing first conversion in stage variable
svr (stage variable)----> DecimalToString(out_data.Duration)
second conversion(string to timestamp) derivation is
StringToTimestamp(svr,'%yyyy-%mm-%dd %hh:%nn:%ss')
Thanks&Regards
S.Swathi
S.Swathi
What you are doing cannot work. Your string picture is in absolutely no way compatible with the decimal numbers you listed. You are telling DataStage to convert the number "85363200" into a date formattedswathi Singamareddygari wrote:StringToTimestamp(svr,'%yyyy-%mm-%dd %hh:%nn:%ss')
as listed above?
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
If your number is of the form 20080303 and you have converted it to a string then you can use StringToDate() but you must provide the correct format string ("%yyyy%mm%dd", with no delimiters). Because you have a string, you can concatenate the time portion and use StringToTimestamp(). Again you need an appropriate format string that describes the format of the string you are supplying.
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.