Timestamp upto milliseconds

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
sharma
Premium Member
Premium Member
Posts: 46
Joined: Mon Dec 24, 2007 2:16 pm

Timestamp upto milliseconds

Post by sharma »

Can timestamp be represented in milliseconds in Datastage and What is the format ?

Currently we are using this format for timestamp is: %yyyy%mm%dd%hh%nn%ss

Can i extend it further to check incooperate milliseconds also ?

Please reply ASAP.
Nirmal Sharma
Ravi.K
Participant
Posts: 209
Joined: Sat Nov 20, 2010 11:33 pm
Location: Bangalore

Post by Ravi.K »

You can use the following format to represent timestamp with milliseconds part.

%yyyy%mm%dd%hh%nn%ss.n

where n is the number of fractional digits with a maximum value of 6.
Cheers
Ravi K
sharma
Premium Member
Premium Member
Posts: 46
Joined: Mon Dec 24, 2007 2:16 pm

Post by sharma »

I am getting the data in this format:
20101221101010437 So this with format %yyyy%mm%dd%hh%nn%ssn is not working.

If i get the data in 20101221101010.437 ( millisecond with dot ) then %yyyy%mm%dd%hh%nn%ss.n is working fine.

So i am getting string without dot (Timestamp string of 17 characters ) which is not working with the format %yyyy%mm%dd%hh%nn%ss.n.

Do i need to use some other format ?

Please respond.
Nirmal Sharma
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Have you tried

Code: Select all

 %yyyy%mm%dd%hh%nn%ss%SSSSSS
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sharma
Premium Member
Premium Member
Posts: 46
Joined: Mon Dec 24, 2007 2:16 pm

Post by sharma »

I am getting this error with this format.

EX: At field "exctn_ts": When validating import/export function: "timestamp_format" property value (%yyyy%mm%dd%hh%nn%ss%SSSSSS) is not a valid format.
Nirmal Sharma
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Sorry. I thought you had a 6 digit millisecond. Use three 'S' instead of six at the end of the format.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sharma
Premium Member
Premium Member
Posts: 46
Joined: Mon Dec 24, 2007 2:16 pm

Post by sharma »

Its still giving me the same error.

EX: At field "exctn_ts": When validating import/export function: "timestamp_format" property value (%yyyy%mm%dd%hh%nn%ss%S) is not a valid format.
Nirmal Sharma
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Not a single 'S' but three 'S's.

Code: Select all

%yyyy%mm%dd%hh%nn%ss%SSS
Unfortunately I cannot test it out as I do not have access to enterprise edition.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sharma
Premium Member
Premium Member
Posts: 46
Joined: Mon Dec 24, 2007 2:16 pm

Post by sharma »

Still the same error.

EX: At field "exctn_ts": When validating import/export function: "timestamp_format" property value (%yyyy%mm%dd%hh%nn%ss%SSS) is not a valid format.

The only format it takes is ".n" in the end.
Nirmal Sharma
Ravi.K
Participant
Posts: 209
Joined: Sat Nov 20, 2010 11:33 pm
Location: Bangalore

Post by Ravi.K »

It is an work around if you really want it as timestamp in your job.

Read it as Varchar(18) and convert to timestamp by using the following derivation and adding "."

StringToTimestamp(Inputcol[1,14]:".":Right(Inputcol,3),"%yyyy%mm%dd%hh%nn%ss.3")
Cheers
Ravi K
sharma
Premium Member
Premium Member
Posts: 46
Joined: Mon Dec 24, 2007 2:16 pm

Post by sharma »

But to make this conversion, i need to use transformer.

Can you please tell me how to do the same using modifier?
Nirmal Sharma
sharma
Premium Member
Premium Member
Posts: 46
Joined: Mon Dec 24, 2007 2:16 pm

Post by sharma »

Timestamp format %yyyy%mm%dd%hh%nn%ss%SSS is working fine.
Make sure the %SSS and nor %sss.

Thanks to everybody.

Regards
~Nirmal
Nirmal Sharma
Post Reply