DateTimeOffsetExtensions.GetAge method

Version 1.1.28
.NET Framework 4.8
Namespace Skybrud.Essentials.Time.Extensions
Assembly Skybrud.Essentials.dll

GetAge(DateTimeOffset)

Extension method

Gets the current age, from the specified date of birth.

public static int GetAge(this DateTimeOffset dateOfBirth)

Parameters

dateOfBirth DateTimeOffset

The date of birth.

Returns

int

An instance of int representing the age.

GetAge(DateTimeOffset, DateTimeOffset)

Extension method

Gets the current age, from the specified date of birth. The age is calculated based on dt.

public static int GetAge(this DateTimeOffset dateOfBirth, DateTimeOffset dt)

Parameters

dateOfBirth DateTimeOffset

The date of birth.

The date used for calculating the age.

Returns

int

An instance of int representing the age.