This is one of those data type conversions which I occasionally have to do in DataStage, but can never seem to remember. So, I thought I would write this quick post to document the data type conversion code, which is really easy, once I finally remember how to do it again.
The TimestampFromDateTime Function
I use the TimestampFromDateTime function to do this data type conversion. I’m sure there are other ways to achieve the result, but I find this method clean and easy to perform. The TimestampFromDateTimefunction is in the Functions > Date & Time menu.
To populate the function, you need only add your date field on use ’00:00:00’ as your time element
TimestampFromDateTime Function Format
TimestampFromDateTime with Time Element example
TimestampFromDateTime(<<Date Field Here>>, ’00:00:00′)
Example transformer code With Date Field
- INFOSPHERE DATASTAGE – HOW TO CONVERT CHAR(0)
- WHAT IS THE CONVERT FUNCTION IN DATASTAGE?
- INFOSPHERE DATASTAGE – HOW TO CALCULATE AGE IN A TRANSFORMER
- DATASTAGE – HOW TO ADD OR SUBTRACT FROM A DATE IN A TRANSFORMER STAGE
- USEFUL IIS DATASTAGE TRANSFORMER VARIABLES AND FUNCTIONS
- IBM INFOSPHERE DATASTAGE TYPE CONVERSION FUNCTIONS