Date 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

Post Reply
pavans
Participant
Posts: 116
Joined: Sun Sep 10, 2006 7:33 am
Location: bangalore, india

Date Conversion

Post by pavans »

HI All,

I have a date field coming from source file which has values like:

2/28/2009 8:03 PM Mchen
2/28/2009 8:03 PM Philip Law

My target is a DB2 Database which is TimeStamp value.

I have searched the forum.
Tried IsValid, Left, Right, Field, StringToTimeStamp but unable to convert the value to a Timestamp.
Any help is really appreciated.
Thanks,
Pavan
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

What exactly did you try? Post your StringToTimestamp attempt syntax and we'll go from there.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Note that "Philip Law" and "Mchen" are not part of any date system that I know of, so you would need to remove that part of the string prior to conversion.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yup, and you typically need to standardize the dates so month/day are forced to two digits and also handle the conversion of AM/PM to military time. Typically.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If not military time ("zulu"), then at least 24-hour clock, ideally using ISO 8601 standards (YYYY-MM-DD HH:MM:SS). You only get one format mask, but days and months can have one or two digits in them. That's why you need to force them to two digits by adding leading zeroes. Try to construct a timestamp string, using substring and concatenation techniques, that matches your default timestamp format; that's the easiest approach.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Sorry, yes meant time on a 24-hour clock not strictly "zulu" or GMT time.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply