Search code examples
datastage

Sum of two time field values in transformer, Datastage


How can I take sum of two time data type field values in transformer in datastage?

For example: In one record, value is: 00:59:59 and in the 2nd record, value is: 00:10:10. Now I want output as 01:09:09.

Could you please help me to solve this.


Solution

  • A time can be converted to seconds by MidnightSecondsFromTime

    MidnightSecondsFromTime("00:59:59")
    

    do this for both times and sum the results. Then covert it back with the DataStage functionality TimeFromMidnightSeconds

    TimeFromMidnightSeconds("240")
    

    Give it a try.