The DiffSeconds function is a built-in function that returns the difference in seconds between dt1 and dt2; i.e. how many seconds have passed between these two dates.  It returns a positive number if dt1 is smaller than dt2; and returns a negative number if dt1 is bigger than dt2.

The DiffSeconds function behaves differently depending on the application server you are using because Daylight Saving Time (DST) is considered in the J2EE server while in the .NET server DST is ignored. Note that the time zone considered for evaluating this function is always the time zone of the Platform Server, regardless of the regional setting of the end-user desktop. The DiffHours and DiffMinutes functions also behaves like this function.

This function is available within the expression editor and the query condition editor.

Input parameters

Output parameters

Examples

Usage

Result

DiffSeconds(#1982-05-21 22:20:30#, #1982-05-21 22:21:05#)

DiffSeconds(#1982-05-21 22:21:05#, #1982-05-21 22:20:30#)

DiffSeconds(#2006-05-21 15:00:00#, #2006-05-22 15:00:00#)

DiffSeconds(#2006-03-25 15:00:00#, #2006-03-26 15:00:00#)

 

 

DiffSeconds(#2006-10-28 15:00:00#, #2006-10-29 15:00:00#)

35

-35

86400

86400 (in a .NET application server) or 82800 (in a J2EE application server), assuming the GMT + 1hour time zone. If your server is in a different time zone, you will get different results.

Note that 2006 Daylight Saving Time starts in Europe on March 26 of 2006.

86400 (in a .NET application server) or 90000 (in a J2EE application server), assuming the GMT + 1hour time zone. If your server is in a different time zone, you will get different results.

Note that 2006 Daylight Saving Time ends in Europe on October 29 of 2006.

Remarks

When using this function you must be aware that the maximum value supported by Service Studio is (2 ^ 31) -1 seconds, which corresponds to approximately 68.05 years.

If DiffSeconds (dt1, dt2) is bigger than 2147483647, you will get an unexpected value.

You should also check the limits of the DateTime and Integer data types.

See Also

Available Data and Time Functions | Available Built-in Functions