DateFromString Function

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
Rajesekhar
Participant
Posts: 19
Joined: Fri May 14, 2010 3:54 pm

DateFromString Function

Post by Rajesekhar »

Hi Iam trying to convert String to Date using Modify Stage.

And the function which iam using is

Date:Date=date_from_string[%mmm %dd, %yyyy](Date)

My input format is of string and is like June 14, 2010

when I run this it gives a warning saying

Data string 'June 14, 201' does not match format '%mmm %dd, %yyyy': an integer was expected to match tag %dd.

What is this warning, how to resolve this please help!!

-thanks, Raj.
Rajesekhar Potteti
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

"%mmm" matches the three-character abbreviation of the month name.

You need to research the correct formulation in the date format picture. From memory - because I can't check at the moment, the full month name is pictured by "%mmmm".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
rameshkm
Participant
Posts: 24
Joined: Tue May 06, 2008 6:02 am
Location: chennai
Contact:

date Function by Using Modify stage

Post by rameshkm »

Hi Rajeseaker,
You mention as Date:Date= What is the first Date mean is it the column name , if yes please change the Column name because The Date is datatype so it not accept as column name, the correct syntax is

Source _ColumnName:datatype =date_from_string(Destination column name["%mmm %dd, %yyyy"]
Let me know if it work
Ramesh Kumar.M
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

I think you need training in 'datastage'. :)
antonyraj.deva
Premium Member
Premium Member
Posts: 138
Joined: Wed Jul 16, 2008 9:51 pm
Location: Kolkata

Post by antonyraj.deva »

As pointed by Ray, for full month name %mmmm should be specified.

"%mmm" will give January as Jan, September as Sep etc,.

So the code for your requirement is

Code: Select all

Source _ColumnName:datatype =date_from_string(Destination column name["%mmmm%dd, %yyyy"] 
TONY
ETL Manager
Infotrellis India

"Do what you can, with what you have, from where you are and to the best of your abilities."
Post Reply