TimestampToString Format String Requirements

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
dougcl
Premium Member
Premium Member
Posts: 137
Joined: Thu Jun 24, 2010 4:28 pm

TimestampToString Format String Requirements

Post by dougcl »

Hi folks, in a transformer derivation I find that this works fine:

Code: Select all

TimestampToString(lnk_lkp_ip_flowsheet_rows.RECORDED_TIME,"%yyyy-%mm-%dd %hh:%nn:%ss")
But this:

Code: Select all

TimestampToString(lnk_lkp_ip_flowsheet_rows.RECORDED_TIME,"%hh:%nn:%ss")
throws the following:

Code: Select all

APT_CombinedOperatorController(6),9: Caught exception from runLocally(): APT_ParseError: Parsing parameters "%hh:%nn:%ss" for conversion "string=string_from_timestamp[%yy-%mm-%dd %hh:%nn:%ss](timestamp)": APT_Conversion_String_TimeStamp: Invalid format [%hh:%nn:%ss] used for string_from_time type conversion.
By the way, I am really trying to write it without the colons either, but this seems like a clearer example.

Does it need all the little date and time pieces in there to work? Hmmm, perhaps this parameter exists only to inform the function of the job's date format? Man, that's weird.

Thanks,
Doug
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Re: TimestampToString Format String Requirements

Post by kris007 »

dougcl wrote: Does it need all the little date and time pieces in there to work?
Because you are using TimeStampToString, the function expects you to describe the way the timestamp in the input data looks. If all you are interested is the time part of the Timestamp you can use TimeStampToTime and then convert it into String and trim the colons if you want to.

Hope that helps
Kris

Where's the "Any" key?-Homer Simpson
Post Reply