String to Timestamp

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
kumar66
Participant
Posts: 265
Joined: Thu Jul 26, 2007 12:14 am

String to Timestamp

Post by kumar66 »

Hi All,

I want to change a string value (2009-12-13 10:10:25 ) to Timestamp(13/12/2009 10:10:25)

I tried StringtoTimestamp(Input,,"%dd/%mm/%yyyy %hh:%nn:%ss").

But this conversion function is not giving desired output for me.

Please Advise.

Thanks,
Kumar66
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You specified the delimiter incorrectly. It must be precisely specified.

Code: Select all

StringtoTimestamp(Input,,"%dd-%mm-%yyyy %hh:%nn:%ss") 
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar66
Participant
Posts: 265
Joined: Thu Jul 26, 2007 12:14 am

Post by kumar66 »

Hi Ray,

Thanks for your input. I tried , but it gives the follwoing error:

Data string '2009-12-13 08:57:45' does not match format '%dd-%mm-%yyyy %hh:%nn:%ss': the value for tag %mm has fewer characters than expected.

Please Advise.

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

Post by ArndW »

Read the error message in detail and change your format to:

StringtoTimestamp(Input,,"%yyyy-%mm-%dd %hh:%nn:%ss")
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Timestamps have no external format, the mask in the function must match what is coming in in the string field, not what you think it should look like.
-craig

"You can never have too many knives" -- Logan Nine Fingers
mgendy
Premium Member
Premium Member
Posts: 44
Joined: Thu Sep 10, 2009 5:30 am
Contact:

Post by mgendy »

i agree with what chulett said , i also was confused about that before , but now take it as a rule , the mask for the function is telling the function how the input is passed to you and further the function understand the input to manipulate it
Mohmmed Elgendy
Senior System Analyst
Data IntegrationTeam
Etisalat Egypt
+20 1118511161
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

kumar66 wrote:Data string '2009-12-13 08:57:45' does not match format '%dd-%mm-%yyyy %hh:%nn:%ss'
That is precisely correct.

Just look at it!

Then proceed as Arnd advised.
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