Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Get the difference in seconds between Current Date time and a Date Time Field

Martin Nguyen
Tera Contributor

I am writing a business rule that will check a box if a Due Date Time is more then 5 days from the current date. What is the best way to calculate that?

1 REPLY 1

Michael Ritchie
ServiceNow Employee

You can use the gs.dateDiff(startDate, endDate, true) function:


GlideSystem - Global



The true at the end will make it return the value in seconds.   Then you can convert seconds into days.