date 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
Nagac
Premium Member
Premium Member
Posts: 127
Joined: Tue Mar 29, 2011 11:39 am
Location: India

date to timestamp

Post by Nagac »

Hi all,

Could you please let me know how can I do a Date to Timestamp conversion. I have a job where I have a date format and need to convert to Time stamp format which is output format. I know we can do timestamp to date using TimestampToDate function. But iam not sure how we can do this. i would like to put zero's in time portion. Please help me out.

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

Post by ray.wurlod »

TimestampToDate() won't help - it goes the wrong way. Do you really need a Timestamp data type, or do you need a string formatted like a timestamp?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
soumya.buna
Participant
Posts: 3
Joined: Tue Apr 01, 2008 7:15 am
Location: Hyderabad

Re: date to timestamp

Post by soumya.buna »

Hi,

if you need default time to be added to the date part then you can go for following conversion.

StringToTimestamp(DateToString(DSLink2.da,"%yyyy-%mm-%dd") : ' 00:00:00',"%yyyy-%mm-%dd %hh:%nn:%ss")

thanks.
Soumyaranjan Mohaptra
Sampath
Participant
Posts: 21
Joined: Tue Apr 05, 2005 2:03 am

Re: date to timestamp

Post by Sampath »

Use Timestamp data type and use function in transformer stage DatetoTimestamp(ColumnName)
Regards,
Sampath
Post Reply