datetime class : TicksDiff(datetime) method

Description

Gets the difference between the caller instance and the argument in ticks.

Syntax

datetimeInstance.TicksDiff(datetime argDatetime)

Arguments

ClassNameDescription
datetimeargDatetimeA datetime class instance that is compared.

Return value

ClassDescription
longThe difference between the caller instance and the argument in ticks.

Sample code

1:

datetime dt = new datetime(2019,1,6,0,0,0);

2:

datetime dt2 = new datetime(2019,1,6,0,0,1);

3:

datetime dt3 = new datetime(2019,1,6,1,0,0);

4:

long diff1 = d2.TicksDiff(dt); // 10000000

5:

long diff2 = dt3.TicksDiff(dt); // 36000000000

Notes

The return value is a number that subtracts argument's time from the caller's time. The unit is ticks.


This method was added in the Ver 1.0.0.1.

Links for reference

None

Copyright © Cooker All rights reserved.