How to convert sting to date(DD-MMM-YY)

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
amreesh_singh
Participant
Posts: 15
Joined: Tue Aug 26, 2008 5:07 am

How to convert sting to date(DD-MMM-YY)

Post by amreesh_singh »

Hi,

I want to convert the string to date(DD-MMM-YY) format. The string is in the following format : 01032008 12:00
I am using StringToDate(DSLink6.EFF,"DD-MMM-YY") but its showing the error
APT_ParseError: Parsing parameters "DD-MMM-YY" for conversion "date=date_from_ustring[%yyyy-%mm-%dd](ustring)": APT_Conversion_String_Date: Invalid Format [DD-MMM-YY] used for string_from_date type conversion.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Perhaps you should ask Gordon Sumner.

Using StringToDate() you must provide the format of the string - that is, the format in which the string is being provided.

In your case you also need to remove the date component from your longer string that also includes the time.

So you need something like:

Code: Select all

StringToDate(Left(InLink.TheString,8),"%mm%dd%yyyy")
(assuming that your string is in month-day-year order - adapt as required).
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 »

ray.wurlod wrote:Perhaps you should ask Gordon Sumner.
Oy, that took a moment or two to puzzle out.
-craig

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