Date to Timestamp conversion

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
pandujoy
Participant
Posts: 70
Joined: Tue May 13, 2008 1:37 pm

Date to Timestamp conversion

Post by pandujoy »

Hi Gurus,

I have timestamp field coming from informix database (12/15/2008 10:11:12 AM) and when i am using the data type for the target as Timestamp i am getting "2008-12-15T16:11:12.000Z" Not sure why i am getting this junk values "T" and "Z"...can anyone help me out..

Thanks in advance
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

First off, those are not "junk" values. The 'T' marks the date/time boundary and the 'Z' means Zulu time, a UTC offset of "00.00" in an ISO 8601 timestamp. See here for the standards, especially pages 2 and 7. What is your target?
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandujoy
Participant
Posts: 70
Joined: Tue May 13, 2008 1:37 pm

Post by pandujoy »

Thanks a lot for the information Chulett .

My input field is timestamp field - "12/15/2008 10:11:12 AM" and my target is timestamp .

Can you please tell me how to resolve this issue
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No, what is your target - a flat file, database table, what? What happens if you declare it as a Varchar there?
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandujoy
Participant
Posts: 70
Joined: Tue May 13, 2008 1:37 pm

Post by pandujoy »

my target is a webservice...Let me check what happens if i declare it as vchar thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

OK, if your target is XML for a webservice the original format posted should work fine, I would think. Have you tried actually using it yet?
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandujoy
Participant
Posts: 70
Joined: Tue May 13, 2008 1:37 pm

Post by pandujoy »

I didnt make any conversion and tried but i gave me the same result...

I tried "TimestamptoString(DSLink12.usg_begin_dt, "%yyyy-%mm-%dd %hh-%nn-%ss.5")" ...when i try to a flat file it worked but with in a service it didnt....

I am not sure how to solve this problem
pandujoy
Participant
Posts: 70
Joined: Tue May 13, 2008 1:37 pm

Post by pandujoy »

Somebody plz help me in resolving this issue... :(
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The Zulu format for xml is a good one. What is your actual error when going to a service?
pandujoy
Participant
Posts: 70
Joined: Tue May 13, 2008 1:37 pm

Post by pandujoy »

Not sure Arnd....

i am getting the result with in the service as "2008-12-15T06:00:00.000Z" I have defined the WISD output datatype as 25,5
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

And is that an error? I am not sure what you want.

If you do

Code: Select all

TimestamptoString(DSLink12.usg_begin_dt, "%yyyy-%mm-%dd %hh-%nn-%ss.5")
what is your output?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So, no actual error - you've just never seen that before and thought there was something wrong with it? Are you trying to send that to the webservice or getting it back from the webservice? Assuming the latter, just strip the "zulu" part and replace the "T" with a space.
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandujoy
Participant
Posts: 70
Joined: Tue May 13, 2008 1:37 pm

Post by pandujoy »

can you tell me how to do...sorry my ignorance
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Our problem is that we don't understand what your problem is.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Can you answer my "Are you trying" question please?
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply