Page 1 of 1

Need to load "2011-02-02T14:05:35" to Timestamp co

Posted: Fri Jul 29, 2011 8:25 am
by mac4rfree85
Hi Guys,

My source is a flat file. I have a timestamp column coming as Varchar. THe data is in the format 2011-02-02T14:05:35.

I need to load it to Timestamp Column.

I am using the below transformation in Transformer.

Code: Select all

StringToTimestamp(Link1.Col1,"%YYYY-%MM-%DDT%hh:%mm:%ss")
But i am getting the below error.

Code: Select all

APT_CombinedOperatorController,0: Caught exception from runLocally(): APT_ParseError: Parsing parameters "%yyyy-%mm-%ddT%hh:%mm:%ss" for conversion "timestamp=timestamp_from_ustring[%yyyy-%mm-%dd %hh:%nn:%ss](ustring)": APT_Conversion_String_TimeStamp: Invalid format [%yyyy-%mm-%ddT%hh:%mm:%ss] used for string_from_time type conversion.
I know we can split it to date and time and then concatanate it. But i like to understand why my transformation is failing.

Cheers!!!!

Posted: Fri Jul 29, 2011 8:39 am
by chulett
Because of the 'T' and thus your use of "%DDT" in the mask. Convert it to a space and then convert the timestamp like 'normal'.

Posted: Fri Jul 29, 2011 11:32 am
by mac4rfree85
Thanks for your help chulett.

You mean to replace "T" with " " and then convert it to Timestamp. But i gues there is no Replace Function in Parallel job.

Really appreciate your help.

Cheers!!!

Posted: Fri Jul 29, 2011 2:17 pm
by chulett
There is, however, a Convert() function which converts one character with another. Same thing, really.

Posted: Tue Aug 02, 2011 5:29 am
by peddakkagari
Hi,

I think no need to convert any thing you can directly use StringToTimestamp function.
I have used the following function it is working fine

StringToTimestamp('2011-02-02T14:05:35',"%yyyy-%mm-%dd %hh:%nn:%ss")

Thanks,
Sreekanth

Posted: Tue Aug 02, 2011 7:08 am
by chulett
That's... interesting. It would seem it doesn't care what comes between the "dd" and "hh" elements. I thought it would be pickier than that. :wink: