How can I convert a string into a date?

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
pavankatra
Participant
Posts: 86
Joined: Wed Mar 03, 2010 3:09 am

How can I convert a string into a date?

Post by pavankatra »

Hi,
my input is 26-feb-2010,i am reading as varchar in the source

Now i want to populate into date column.

i was used below function
StringToDate(Trim(lk_read.expiry_date),"%yyyy-%mmm-%dd").

after executing the job i am getting output as astroids(*********)

Can anyone pleaase help me to sort out the issue.

Thanks in advance.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Your date format is incorrect, it should read "%dd-%mmm%-%yyyy"
pavankatra
Participant
Posts: 86
Joined: Wed Mar 03, 2010 3:09 am

Post by pavankatra »

ArndW wrote:Your date format is incorrect, it should read "%dd-%mmm%-%yyyy" ...
thank you for your reply

i was tried ,but its not working.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I just noticed a typographical error on my part, the format should be
"%dd-%mmm-%yyyy"
pavankatra
Participant
Posts: 86
Joined: Wed Mar 03, 2010 3:09 am

Post by pavankatra »

pavankatra wrote:
ArndW wrote:Your date format is incorrect, it should read "%dd-%mmm%-%yyyy" ...
thank you for your reply

i was tried ,but its not working.
there was space issue with the date,so trim the data and then applied the type conversion function.Now its working fine

Thanks for your support.
Post Reply