string to date 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
prasanna_anbu
Participant
Posts: 42
Joined: Thu Dec 28, 2006 1:39 am

string to date function

Post by prasanna_anbu »

Hi
I have used in a stage variable like

If(LKP_To_TFM_Check_Null.transaction_dt = "") Then 13 else If(Len(LKP_To_TFM_Check_Null.transaction_dt)<11) Then 13 Else If(IsValid("date",StringToDate(LKP_To_TFM_Check_Null.transaction_dt[1,11],"%mmm %dd %yyyy"))) Then 0 Else 13


in this i have get NOV 3 2008 instead NOV 03 2008

or i have get ****** what can i do for this
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

What is your value of LKP_To_TFM_Check_Null.transaction_dt ?
prasanna_anbu
Participant
Posts: 42
Joined: Thu Dec 28, 2006 1:39 am

Post by prasanna_anbu »

the value for LKP_To_TFM_Check_Null.transaction_dt is

Oct 29 2008 12:00:00:000AM

Nov 3 2008 12:00:00:000AM
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Your first problem is the one- or two-digit day numbers in conjunction with a substring that takes the first eleven characters of the string. Get this right first, by substringing into separate components (in stage variables) then manipulating the day number before re-assembly. You need to add the leading zero to the day number if it is a single digit. For example

Code: Select all

Right("00" : svDayNumber, 2)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply