Timestamp to string in modify stage

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
reddy12
Participant
Posts: 99
Joined: Tue Aug 08, 2006 9:34 pm

Timestamp to string in modify stage

Post by reddy12 »

How can i change timestamp field into string and string to timestamp?
give me example on that.

specification property.

Thanks to all guys to sharing your ideas in DSXchange.
diamondabhi
Premium Member
Premium Member
Posts: 108
Joined: Sat Feb 05, 2005 6:52 pm
Location: US

Post by diamondabhi »

search the forum, here are some samples:

string_from_timestamp (timestamp, string)
timestamp_from_string (string, timestamp)
timestamp_from_ustring (ustring, timestamp)
ustring_from_timestamp (timestamp, ustring)
Every great mistake has a halfway moment, a split second when it can be recalled and perhaps remedied.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Same thing can also be done in a px transformer. StringToTimestamp() and TimestampToString() functions, I believe, in the transformer. You can find the complete list under Transforms, under Type Conversion when you right click on the extended derivation window.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In the Modify stage the format string is given in square brackets, the input argument (field name) is given in parentheses. For example

Code: Select all

string_from_timestamp[%yyyy-%mm-%dd %hh:%nn:%ss](MyTimestamp)
Note that minutes are specified as %nn, not %mm.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
reddy12
Participant
Posts: 99
Joined: Tue Aug 08, 2006 9:34 pm

Post by reddy12 »

I am not able to see the code
can you please type only the code?
ray.wurlod wrote:In the Modify stage the format string is given in square brackets, the input argument (field name) is given in parentheses. For example

Code: Select all

string_from_timestamp[%yyyy-%mm-%dd %hh:%nn: ...[/quote]
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

A clear specification with format is given in Parallel Job Developer's guide, Page 28-10,28-11.
I haven't failed, I've found 10,000 ways that don't work.
Thomas Alva Edison(1847-1931)
reddy12
Participant
Posts: 99
Joined: Tue Aug 08, 2006 9:34 pm

Post by reddy12 »

here i am littile bit confusion wtih (timestamp)
string_from_timestamp[timestamp_format] (timestamp)

string_from_timestamp[%yyyy-%mm-%dd %hh:%nn:%ss](DATEFIELD)
Is this above code correct?
us1aslam1us wrote:A clear specification with format is given in Parallel Job Developer's guide, Page 28-10,28-11.
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

Yes Perfect!!
I haven't failed, I've found 10,000 ways that don't work.
Thomas Alva Edison(1847-1931)
Post Reply