StringtoTimestamp using AM/PM not working

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
ggarze
Premium Member
Premium Member
Posts: 78
Joined: Tue Oct 11, 2005 9:37 am

StringtoTimestamp using AM/PM not working

Post by ggarze »

Running 8.5 on unix

Input Strings coming in as:
1/1/2007 10:05:00 PM
12/10/2007 1:00:00 AM

Running this: StringToTimestamp(DSLink2.timestamp,"%(m,s)/%(d,s)/%yyyy %(h,s):%nn:%ss") outputs the data as:
01/01/2007 10:05:00
12/10/2007 01:00:00

I'd like the first timestamp since PM to be
01/01/2007 22:05:00

SO, as manual instructs I run it as this:
StringToTimestamp(DSLink2.timestamp,"%(m,s)/%(d,s)/%yyyy %(h,s):%nn:%ss %aa")

Process aborts with the following:
Caught exception from runLocally(): APT_ParseError: Parsing parameters "%(m,s)/%(d,s)/%yyyy %(h,s):%nn:%ss %aa" for conversion "timestamp=timestamp_from_string[%yyyy-%mm-%dd %hh:%nn:%ss](string)": APT_Conversion_String_TimeStamp: Invalid format [%(m,s)/%(d,s)/%yyyy %(h,s):%nn:%ss %aa] used for string_from_time type conversion.

No matter how I try to swing the %aa as the manual shows it aborts and says it's an invalid format.

Thanks
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

You need to use %(H,s), the lowercase h states 24 hour clock which is not compatible with am/pm
ggarze
Premium Member
Premium Member
Posts: 78
Joined: Tue Oct 11, 2005 9:37 am

Post by ggarze »

That worked thanks. I see the %aa is not compatible with %hh which means 24 hour clock while %HH means 12 hour clock. thanks again
Post Reply