DateTimeExtensions.GetAge method

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

GetAge(DateTime)

Extension method

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

public static int GetAge(this DateTime dateOfBirth)

Parameters

dateOfBirth DateTime

The date of birth.

Returns

int

An instance of int representing the age.

GetAge(DateTime, DateTime)

Extension method

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

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

Parameters

dateOfBirth DateTime

The date of birth.

The date used for calculating the age.

Returns

int

An instance of int representing the age.