Date Time YYYYMMDD HH:NN:SS:SSSSSS format

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
rameshkm
Participant
Posts: 24
Joined: Tue May 06, 2008 6:02 am
Location: chennai
Contact:

Date Time YYYYMMDD HH:NN:SS:SSSSSS format

Post by rameshkm »

Hi Experts,

I am having a string value as "20130305 07:41:45.798181", need to convert into timestamp.

I have used

StringToTimestamp(<Column Name > , yyyy%mm%dd %hh:%nn:%s:%SSSSSS,v")
.But throwing error. Kindly help me to fix this.

Thanks In advance.
Ramesh
Ramesh Kumar.M
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

It's helpful to include the error message you received. Without it, the forum members are left to guess or assume.

One thing to point out: Your example string data has a decimal point between the seconds and microseconds ("45.798181"), but your format string has a semicolon between the seconds and microseconds ("%s:%SSSSSS,v"). Perhaps that is part of the problem? As always, refer to the documentation for format string guidance.

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
rameshkm
Participant
Posts: 24
Joined: Tue May 06, 2008 6:02 am
Location: chennai
Contact:

Thanks a lot jwiles

Post by rameshkm »

Please find the more detail.

Now i have tried for the date "20130102 16:40:40.84282" as

StringToTimestamp(Field(in.Timestamp,'-',1),"%yyyy%mm%dd %hh:%nn:%ss.6")

Now the error message is

Transformer_18,1: Data string '"20130102 16:40:40.84282' does not match format '%yyyy%mm%dd %hh:%nn:%ss.6': an integer was expected to match tag %yyyy.

Please help me...
Ramesh Kumar.M
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Your error message shows a double-quote as the first character of the date string inside the single quotes of the message itself.
-craig

"You can never have too many knives" -- Logan Nine Fingers
raju4u
Participant
Posts: 56
Joined: Thu Dec 13, 2007 12:30 am

Post by raju4u »

try this..
StringToTimestamp(DateToString(DSLink2.d1,"%yyyy-%mm-%dd"):' 00:00:00.000000',"%yyyy-%mm-%dd %hh:%nn:%ss.6")
N R REDDY
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

raju4u wrote:StringToTimestamp(DateToString(DSLink2.d1,"%yyyy-%mm-%dd"):' 00:00:00.000000',"%yyyy-%mm-%dd %hh:%nn:%ss.6")
Sorry, but why? They don't want to lose the time component and the mask you provided doesn't match the incoming string.
-craig

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