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
dsdeveloper66
Participant
Posts: 2
Joined: Tue Jun 17, 2008 4:39 pm

String to timestamp

Post by dsdeveloper66 »

Hi,
Iam using the function
StringToTimestamp(DSLink2.XXXX,"yyyy-mm-dd hh:nn:ss")

DSLink2.XXXX='2005-01-01 12:01:01'(varchar(50))

When i tried to execute above, getting the following error.

Transformer_3,0: Caught exception from runLocally(): APT_ParseError: Parsing parameters "yyyy-mm-dd hh:nn:ss" for conversion "timestamp=timestamp_from_string[%yyyy-%mm-%dd %hh:%nn:%ss](string)": APT_Conversion_String_TimeStamp: Invalid Format [yyyy-mm-dd hh:nn:ss] used for string_from_time type conversion.

I looked into forums but could not get exact error posts.

we are having datastage v 7.5.1

Thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You missed all of the '%' markers:

Code: Select all

StringToTimestamp(DSLink2.XXXX,"%yyyy-%mm-%dd %hh:%nn:%ss") 
-craig

"You can never have too many knives" -- Logan Nine Fingers
LavanyaRamesh007
Participant
Posts: 42
Joined: Mon Apr 21, 2008 1:49 am

Post by LavanyaRamesh007 »

I have a question.. I just want to know how this function works internally..
say I have a string
20030707

StringtoTimestamp converts the given string into time. %yyyy%dd%mm says let the first four characters be year. Next two be date and next two be month isnt??

If i dont specify the format what happens..???
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

If i dont specify the format what happens..???
then what will be your command??


it will fail to convert.
vercama
Participant
Posts: 11
Joined: Thu Aug 07, 2008 3:21 am

DS manual

Post by vercama »

keshav0307 wrote:
If i dont specify the format what happens..???
then what will be your command??


it will fail to convert.


Hi,
does anybody know where I can find a DS manual with the list of available transformation functions, please?

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

Post by ArndW »

On your pc, the PDF document is titled QualityStageParallel Job Developer Guide.
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

F1 in the transformer stage, The help.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In the Administrator client you can set default date, time and timestamp formats for the project (and the default decimal placeholder character). It is these that are used if no format string is provided, for better or worse.

The Transformer stage is documented in the Parallel Job Developer's Guide with its functions documented in an Appendix of that manual.
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