String 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

kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Did you try StringToTimestamp(DSLink4.time,"%yyyy%mm%dd%hh.%mm.%ss %aa")?
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

How is "yyyymmddhh.mm.ss am" the same as below?
satishm wrote: StringToTimestamp(DSLink4.time,"%yyyy%mm%dd %hh.%nn.%ss %aa")
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Okie, just saw your parallel post for my late question.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
satishm
Participant
Posts: 22
Joined: Wed Aug 20, 2008 6:37 am

Post by satishm »

kumar_s wrote:Did you try StringToTimestamp(DSLink4.time,"%yyyy%mm%dd%hh.%mm.%ss %aa")? ...
yeah..I tried but job got aborted.see error in my prvious post..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

%hh is a 24 hour format, you'd need to use %H or %HH for 12 hour, depending on if the length of that portion is variable (1...12) or fixed (01...12) in size.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

chulett wrote:%hh is a 24 hour format, you'd need to use %H or %HH for 12 hour, depending on if the length of that portion is variable (1...12) or fixed (01...12) in size. ...
Which, of course, the help files explain
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Of course. That and so much more. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
newtier
Premium Member
Premium Member
Posts: 27
Joined: Mon Dec 13, 2004 5:50 pm
Location: St. Louis, MO

Post by newtier »

satishm wrote:
satishm wrote:
chulett wrote:What solution did you use - all that extra work using stage variables or the proper StringToTimestamp function syntax that Kryt0n helped out with? ...
One which Neena provided, as i dont wanna store am/pm in table and also wanna store it in 24 hrs format..
She provided a perfect solution.

But thanks to all for all the help.

Ran the job using

StringToTimestamp(DSLink4.time,"%yyyy%mm%dd %hh.%nn.%ss %aa")

got aborted with following error
APT_CombinedOperatorController,0: Unrecognized timestamp format identifier: %97
APT_CombinedOperatorController,0: Caught exception from runLocally(): APT_ParseError: Parsing parameters "%yyyy%mm%dd %hh.%nn.%ss %aa" for conversion "timestamp=timestamp_from_string[%yyyy-%mm-%dd %hh:%nn:%ss](string)": APT_Conversion_String_TimeStamp: Invalid Format [%yyyy%mm%dd %hh.%nn.%ss %aa] used for string_from_time type conversion.
Operator signalled one or more errors.

Looking at your "actual" input data ... is there a space between the day and hour? (your format looks like you have a space there)
Rick H
Senior Consultant
Post Reply