You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How to add seconds to timestamp in groovy script

in Sales 4 comments

Will would need to validate an opportunity keeping it editable for few seconds, then the sales stage changes into a particular value (after that the opportunity can not be editable anymore).

The script below works adding days, but it doesn't work for seconds (e.g. using decimal values instead of integer)


def curTime = now();
println("curTime: "+curTime.toString())
int daysModAllowed = 1;
def futureTime = curTime + daysModAllowed;
println("futureTime: "+futureTime.toString())

if(futureTime > curTime){
println("futureTime > curTime")
return true
}
return false

Below the Runtime Messages
curTime: 2025-02-02 15:48:17.463
futureTime: 2025-02-03 15:48:17.463
futureTime > curTime

is there a way to add 10 seconds to the current timestamp?

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!