Date Conversion

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

thatiprashant
Participant
Posts: 25
Joined: Mon Sep 19, 2005 11:32 am

Date Conversion

Post by thatiprashant »

hi,,

i have got a query where in i will get date and timestamp like
12/10/2005 11:20:21
i need to transform that into two colums in the next stage with date and time as a seperate columns.

help is appreciated
thanks
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

you can use substrings function to do that.

Thanks
Sam
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Or use the Field() function.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
travis
Premium Member
Premium Member
Posts: 11
Joined: Fri Mar 15, 2002 10:46 am
Location: USA

Or

Post by travis »

You could also do DateField[1,10] in the first column and DateField[12,8]
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

DateFromTimestamp() and TimeFromTimestamp() functions seem to be the obvious candidates. You will need a format string if your timestamp does not correspond to your project's default format.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
thatiprashant
Participant
Posts: 25
Joined: Mon Sep 19, 2005 11:32 am

Post by thatiprashant »

ray.wurlod wrote:DateFromTimestamp() and TimeFromTimestamp() functions seem to be the obvious candidates. You will need a format string if your timestamp does not correspond to your project's default format. ...
thanks for ur reply ray,,but i dont have DateFromTimestamp() in my DS7.5.1,, can you please explain more as i am very new to DS
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You do have it. Use the Expression Editor in a Transformer stage. It will appear in among the available Functions.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
thatiprashant
Participant
Posts: 25
Joined: Mon Sep 19, 2005 11:32 am

Post by thatiprashant »

ray.wurlod wrote:You do have it. Use the Expression Editor in a Transformer stage. It will appear in among the available Functions. ...
thanks for ur reply,,i found timestamptodate function and when i am trying to use it it gives timestamp qoute,,can you pls help me wat to enter in that
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

Hi Thati,

Code: Select all

TimestampToTime(DSLink3.columnname)
That will do the job.

Sam
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

thatiprashant wrote:
ray.wurlod wrote:You do have it. Use the Expression Editor in a Transformer stage. It will appear in among the available Functions. ...
thanks for ur reply,,i found timestamptodate function and when i am trying to use it it gives timestamp qoute,,can you pls help me wat to enter in that
Sorry, could you be clear on what you need?
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The timestamp in quotes is a format string. You do not require this if your timestamp matches the default timestamp format for the job.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
thatiprashant
Participant
Posts: 25
Joined: Mon Sep 19, 2005 11:32 am

Post by thatiprashant »

us1aslam1us wrote:Hi Thati,

Code: Select all

TimestampToTime(DSLink3.columnname)
That will do the job.

Sam
thanks for the reply sam,, i did try that but it just gives the date as ******
and time rounded as 0 like 00:00:00

help on this wud be apreciated.

thanks
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

If your timestamp is with ' ', which is in string format, try using StringToTimestamp to convert to timestamp and later you can tyr using the mentioned function.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
thatiprashant
Participant
Posts: 25
Joined: Mon Sep 19, 2005 11:32 am

Post by thatiprashant »

kumar_s wrote:If your timestamp is with ' ', which is in string format, try using StringToTimestamp to convert to timestamp and later you can tyr using the mentioned function. ...
thanks for response,,my timestamp is in normal form with 18/12/1979 12:30:55

thanks
thatiprashant
Participant
Posts: 25
Joined: Mon Sep 19, 2005 11:32 am

Post by thatiprashant »

ray.wurlod wrote:The timestamp in quotes is a format string. You do not require this if your timestamp matches the default timestamp format for the job. ...
thanks ray,,my time format matches for the job, but its still asking me to enter in quotes without that its not accepting

thanks
Post Reply