'Add to the DataStage transformer for system date in format "mm/dd/yyyy hh:mm:ss"

Is there any one helping me for datetime convention in Datastage?

I need to add to the datastage transformer the system date in format "mm/dd/yyyy hh:mm:ss"

I'm using Datastage 7.5 version.



Solution 1:[1]

Try this function DateCurrentDateTime()

Solution 2:[2]

We can convert date through Parallel or Server job using differnt process.

  1. In parallel job you use Field function to split the the date and time part. i.e. Field(currentTimeStamp()," ",1) : " " : Field(currentTimeStamp()," ",2) ... by default date format in datastage is %yyyy-%mm-%dd, now use substring to change the format of date like %mm/%dd/%yyyy, so, Field(currentTimeStamp()," ",1)[6,2] : "/" : Field(currentTimeStamp()," ",1)[9,2] : "/" : Field(currentTimeStamp()," ",1)[1,4] : " " : Field(currentTimeStamp()," ",2).

  2. In server job us simple use below function: Oconv(Iconv(DATE(),"D-YMD[4,2,2]"),"D/MDY[2,2,4]"):" ":Oconv(TIME(),"MTS")

Solution 3:[3]

You can try the below function :

Oconv(Iconv(Oconv(@DATE,"D-YMD[4,2,2]"):'-':Change(Oconv(@TIME,"MTS"), ":", ":"),D-MDY[2,2,4]),'D-MDY[2,2,4]')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Random
Solution 2 Jeet
Solution 3 Pooja25