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

.TotalMilliseconds returns the whole length of a TimeSpan in milliseconds.

Syntax

aTimeSpan.TotalMilliseconds

Returns

Double

Example

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

Result: 281670250

Model example

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

(self.ChangeTime - self.CreateTime).TotalMilliseconds

Notes

  • A negative TimeSpan gives a negative result.
  • To get just the milliseconds part (0–999), use Milliseconds.
  • For an exact whole-number count with no rounding, use Ticks. One millisecond is 10,000 ticks.

See also