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

.Days returns the days part of a TimeSpan as a whole number. Any hours, minutes, seconds or milliseconds left over are dropped, not rounded.

Syntax

aTimeSpan.Days

Returns

Integer

Example

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

Result: 3

The TimeSpan is 3.06:14:30.250. .Days returns only the 3; the 6 hours are dropped.

Model example

Whole days an employee has been employed, in the context of Employee:

(DateTime.Today - self.HireDate).Days

Notes

  • .Days has no upper limit. A span of 400 days returns 400.
  • A negative TimeSpan gives a negative result: (DateTime.Parse('2026-11-20') - DateTime.Parse('2026-11-23 06:00')).Days returns -3.
  • For the full length including fractions, use TotalDays.

See also