If you could change your need to add one minute instead of one second the ADDMINUTE() function would make this very simple.
If you actually need to add a second you have a tough problem on your hands. Time-based math is not fun, but the typical approach to handling it is to make your time object a numeric, do the math, then revert from numeric to time. This approach solves the problem of having 59 seconds plus one, which makes 00 seconds plus 1 new minute. The function to revert numeric to time handles all that for you.
There are no built in functions to do time to number but the formula is not difficult:
TEXTTONUMBER(FROMDATETIME(CURRENTTIME(), "{HH24}")) * 36000000) +
TEXTTONUMBER(FROMDATETIME(CURRENTTIME(), "{MM}")) * 600000) +
TEXTTONUMBER(FROMDATETIME(CURRENTTIME(), "{SS3-3}")
this returns a numeric value of accumulated milliseconds in a given day. You could enhance to add days as well if needed.
With a numeric value representing the current time in milliseconds you can add 1000 to that to get a new value one second beyond. the you would reverse the math, getting the hour, minute, and milliseconds by dividing and subtracting as you go.
Not pretty at all and a lot of simple math but it would work.
Other alternatives would be to use Java and a JEXIT() call. That's a heavy lift just to add one second to a given time. Same for shelling out to the OS - Linux has some easy ways to add one second with enhanced date command line options but still a heavy lift for a small reward.
I would get the OK to just add a minute if at all possible. quick and easy. Otherwise the math approach would work after you test out the formulas to ensure you're getting what you want.
Jim
------------------------------
Jim Davee
------------------------------
Original Message:
Sent: Wed June 11, 2025 12:51 AM
From: Zaid Lalkate
Subject: Adding seconds to CURRENTDATETIME
Can anyone reply on this.
------------------------------
Zaid Lalkate
------------------------------
#IBMSterlingTransformationExtender
#IBM-Websphere-Transformation-Extender
------------------------------
Zaid Lalkate
Original Message:
Sent: Mon May 19, 2025 05:19 AM
From: Zaid Lalkate
Subject: Adding seconds to CURRENTDATETIME
I have a requirement to add 1 second to CURRENTDATEDATE and assign to output DateTime field. Since, we do not have any inbuilt function for the same, need to know if we have any other simple way for the same
------------------------------
Zaid Lalkate
------------------------------
#IBMSterlingTransformationExtender
#IBM-Websphere-Transformation-Extender