Page 1 of 1

Date Time YYYYMMDD HH:NN:SS:SSSSSS format

Posted: Mon Mar 11, 2013 4:02 pm
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

Posted: Mon Mar 11, 2013 4:51 pm
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,

Thanks a lot jwiles

Posted: Mon Mar 11, 2013 8:00 pm
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...

Posted: Mon Mar 11, 2013 9:52 pm
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.

Posted: Tue Mar 12, 2013 2:37 am
by raju4u
try this..
StringToTimestamp(DateToString(DSLink2.d1,"%yyyy-%mm-%dd"):' 00:00:00.000000',"%yyyy-%mm-%dd %hh:%nn:%ss.6")

Posted: Tue Mar 12, 2013 7:37 am
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.