Skip to content

DateTimeExtensions

Lee Conlin edited this page Mar 19, 2020 · 2 revisions

DateTimeExtensions.Between(dateTimeToTest, d1, d2)

Is the dateTimeToTest between the other dates

Name Description
dateTimeToTest System.DateTime
d1 System.DateTime
One end of the range
d2 System.DateTime
The other end of the range

Returns

True if the input DateTime is between the given DateTimes (inclusive of those date/times)

DateTimeExtensions.IsWeekday(date)

Identifies whether the given DateTime is a weekday (Mon - Fri)

Name Description
date System.DateTime

Returns

True if the input DateTime is a weekday, otherwise false.

DateTimeExtensions.IsWeekend(date)

Identifies whether the given DateTime is a weekend (Sat/Sun)

Name Description
date System.DateTime

Returns

True if the DateTime is a weekend, otherwise false.

DateTimeExtensions.NextWeekday(date)

Returns the DateTime of the next weekday after the input DateTime

Name Description
date System.DateTime

Returns

A DateTime that represents the next weekday after the input DateTime

DateTimeExtensions.ToAgeInYears(dateOfBirth)

Calculates the age in years given a date of birth. Accurate to the day.

Name Description
dateOfBirth System.DateTime

Returns

Age in years as an integer based on the input date vs DateTime.Now.