🚀 Welcome to MDriven Learn –  Don’t miss the latest Release Notes.
OCLOperators TotalSeconds

.TotalSeconds returns the whole length of a TimeSpan in seconds, as a decimal number. The milliseconds left over become the fractional part.

Syntax

aTimeSpan.TotalSeconds

Returns

Double

Example

(DateTime.Parse('2026-11-23 14:30:00.250') - DateTime.Parse('2026-11-20 08:15:30')).TotalSeconds

Result: 281670.25

Model example

Seconds between an object's creation and its last change, in the context of any class that inherits from SysSuperClass:

(self.ChangeTime - self.CreateTime).TotalSeconds

Notes

  • A negative TimeSpan gives a negative result.
  • To get just the seconds part (0–59), use Seconds.

See also