Noda Time
Between Method (start, end, units)
NamespacesNodaTimePeriodBetween(LocalDateTime, LocalDateTime, PeriodUnits)

[This is preliminary documentation and is subject to change.]

Returns the period between a start and an end date/time, using only the given units.
Declaration Syntax
C#Visual BasicVisual C++
public static Period Between(
	LocalDateTime start,
	LocalDateTime end,
	PeriodUnits units
)
Public Shared Function Between ( _
	start As LocalDateTime, _
	end As LocalDateTime, _
	units As PeriodUnits _
) As Period
public:
static Period^ Between(
	LocalDateTime start, 
	LocalDateTime end, 
	PeriodUnits units
)
Parameters
start (LocalDateTime)
Start date/time
end (LocalDateTime)
End date/time
units (PeriodUnits)
Units to use for calculations
Return Value
The period between the given date/times, using the given units.
Remarks
If end is before start, each property in the returned period will be negative. If the given set of units cannot exactly reach the end point (e.g. finding the difference between 1am and 3:15am in hours) the result will be such that adding it to start will give a value between start and end. In other words, any rounding is "towards start"; this is true whether the resulting period is negative or positive.
Exceptions
ExceptionCondition
ArgumentExceptionunits is empty or contained unknown values.
ArgumentExceptionstart and end use different calendars.

Assembly: NodaTime (Module: NodaTime.dll) Version: 1.2.0.0 (1.2.0)