Decimal to Timestamp 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

Post Reply
gyani12
Participant
Posts: 1
Joined: Fri Jun 09, 2006 9:05 am
Location: HYDERABAD

Decimal to Timestamp conversion

Post by gyani12 »

Hi,

I have input column as decimal(38,10) value as e.g "0000000000000000000020070123.0000000000" need to convert into timestamp as "2007-01-23 00:00:00"

What function I can use in transformer to convert from decimal to timestamp. Please provide info.

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

Post by DSguru2B »

Welcome Aboard :)
Apply DecimalToString(). Use Field() to get everything before the decimal and, concatenate the time and then use StringToTimestamp().
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Will the portion to the right of the decimal place ever contain the time portion? You need to plan for these contingencies, particularly if you seek to create re-usable components.

Extend the method suggested by DSguruji. Use the Field() function to retrieve all the digits to the right of the decimal place, then the Left() or Right() function as appropriate to yield the correct eight digits before converting to a time using StringToTime() function.
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