Conversion from String to 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
bala_135
Premium Member
Premium Member
Posts: 156
Joined: Fri Oct 28, 2005 1:00 am
Location: Melbourne,Australia

Conversion from String to Date

Post by bala_135 »

Hi,

I have a column with Datatype varchar length 19.It's a date column.I wanted varchar type to be changed to date.

I am trying the following.

source field->5/1/2003 0:00:00 datatype- varchar length- 19
Transform function->StringToDate(DSLink8.First_Due_Date).
Result---->**********

Any suggestions.

Regards,
Bala.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Bala,

the date functions in PX are very particular when it comes to formatting; and the default of %dd/%mm/%yyyy %hh:%nn:%ss doesn't match your string - thus the output is undefined. You will need to change your input string to have a fixed length format before you can use the StringToDate() function.
ganive
Participant
Posts: 18
Joined: Wed Sep 28, 2005 7:06 am

Re: Conversion from String to Date

Post by ganive »

Hi,

You have to enter the StringToDate Function which format your source string is.

In your Case, use :
StringToDate(DSLink8.First_Due_Date,"%dd%mm%yyyy %hh%nn%ss")
Maybe you'll have to manipulate your source field so that it can fit the format.

Also, beware of NULLABLE field while applying such function (of your source field is nullable, you have to handle it).

++
bala_135 wrote:Hi,

I have a column with Datatype varchar length 19.It's a date column.I wanted varchar type to be changed to date.

I am trying the following.

source field->5/1/2003 0:00:00 datatype- varchar length- 19
Transform function->StringToDate(DSLink8.First_Due_Date).
Result---->**********

Any suggestions.

Regards,
Bala.
--------
GaNoU
--------
Post Reply