OCLOperators Ticks
.Ticks returns the whole length of a TimeSpan in ticks. A tick is the smallest unit of time in .NET: 100 nanoseconds. Unlike the other parts (.Days, .Hours and so on), .Ticks covers the entire span, so it works like a "total" value, but as an exact whole number.
Syntax
aTimeSpan.Ticks
Returns
Integer (64-bit)
Example
(DateTime.Parse('2026-11-23 14:30:00.250') - DateTime.Parse('2026-11-20 08:15:30')).Ticks
Result: 2816702500000
Tick conversions
| Unit | Ticks |
|---|---|
| 1 millisecond | 10,000 |
| 1 second | 10,000,000 |
| 1 minute | 600,000,000 |
| 1 hour | 36,000,000,000 |
| 1 day | 864,000,000,000 |
Notes
- Use
.Tickswhen you need an exact comparison or sort key with no floating-point rounding. - To move a DateTime by a number of ticks, use AddTicks.
