TimeUtils.GetAge method

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

GetAge(DateTime, int, int, int)

Static

Returns the age as calculated between then and the date identified by the specified year, month and day.

public static int GetAge(DateTime then, int year, int month, int day)

Parameters

then DateTime

The date.

year int

The year of the date to compare against.

month int

The year of the date to compare against.

day int

The year of the date to compare against.

Returns

int

The calculated age between thespecified date and the current date.

GetAge(int, int, int, int, int, int)

Static

Returns the age as calculated between two dates.

public static int GetAge(int year1, int month1, int day1, int year2, int month2, int day2)

Parameters

year1 int

The year of the first date.

month1 int

The month of the first date.

day1 int

The day of the first date.

year2 int

The year of the date to compare against.

month2 int

The month of the date to compare against.

day2 int

The day of the date to compare against.

Returns

int

The calculated age between the two dates.

GetAge(DateTime)

Static

Returns the age as calculated between then and the current date.

public static int GetAge(DateTime then)

Parameters

then DateTime

The date of birth.

Returns

int

The age calculated between the current date and then.

GetAge(DateTime, DateTime)

Static

Gets the current age, from the specified dateOfBirth. The age is calculated based on compare.

public static int GetAge(DateTime dateOfBirth, DateTime compare)

Parameters

dateOfBirth DateTime

The date of birth.

compare DateTime

The date used for calculating the age.

Returns

int

The age based on the specified dateOfBirth at the moment of compare.

GetAge(DateTime, DateTimeOffset)

Static

Gets the current age, from the specified dateOfBirth. The age is calculated based on compare.

public static int GetAge(DateTime dateOfBirth, DateTimeOffset compare)

Parameters

dateOfBirth DateTime

The date of birth.

compare DateTimeOffset

The date used for calculating the age.

Returns

int

The age based on the specified dateOfBirth at the moment of compare.

GetAge(DateTime, EssentialsDate)

Static

Gets the current age, from the specified dateOfBirth. The age is calculated based on dt.

public static int GetAge(DateTime dateOfBirth, EssentialsDate dt)

Parameters

dateOfBirth DateTime

The date of birth.

The date used for calculating the age.

Returns

int

The age based on the specified dateOfBirth at the moment of dt.

GetAge(DateTime, EssentialsDateTime)

Static

Gets the current age, from the specified dateOfBirth. The age is calculated based on dt.

public static int GetAge(DateTime dateOfBirth, EssentialsDateTime dt)

Parameters

dateOfBirth DateTime

The date of birth.

The date used for calculating the age.

Returns

int

The age based on the specified dateOfBirth at the moment of dt.

GetAge(DateTime, EssentialsTime)

Static

Gets the current age, from the specified dateOfBirth. The age is calculated based on dt.

public static int GetAge(DateTime dateOfBirth, EssentialsTime dt)

Parameters

dateOfBirth DateTime

The date of birth.

The date used for calculating the age.

Returns

int

The age based on the specified dateOfBirth at the moment of dt.

GetAge(DateTimeOffset)

Static

Returns the age as calculated between then and the current date.

public static int GetAge(DateTimeOffset then)

Parameters

The date of birth.

Returns

int

The age calculated between the current date and then.

GetAge(DateTimeOffset, DateTime)

Static

Returns the age, from the specified then. The age is calculated based on compare.

public static int GetAge(DateTimeOffset then, DateTime compare)

Parameters

The date of birth.

compare DateTime

The date used for calculating the age.

Returns

int

The age based on the specified then at the moment of compare.

GetAge(DateTimeOffset, DateTimeOffset)

Static

Returns the age, from the specified then. The age is calculated based on compare.

public static int GetAge(DateTimeOffset then, DateTimeOffset compare)

Parameters

The date of birth.

compare DateTimeOffset

The date used for calculating the age.

Returns

int

The age based on the specified then at the moment of compare.

GetAge(DateTimeOffset, EssentialsDate)

Static

Gets the current age, from the specified then. The age is calculated based on compare.

public static int GetAge(DateTimeOffset then, EssentialsDate compare)

Parameters

The date of birth.

compare EssentialsDate

The date used for calculating the age.

Returns

int

The age based on the specified then at the moment of compare.

GetAge(DateTimeOffset, EssentialsDateTime)

Static

Gets the current age, from the specified then. The age is calculated based on compare.

public static int GetAge(DateTimeOffset then, EssentialsDateTime compare)

Parameters

The date of birth.

The date used for calculating the age.

Returns

int

The age based on the specified then at the moment of compare.

GetAge(DateTimeOffset, EssentialsTime)

Static

Gets the current age, from the specified then. The age is calculated based on compare.

public static int GetAge(DateTimeOffset then, EssentialsTime compare)

Parameters

The date of birth.

compare EssentialsTime

The date used for calculating the age.

Returns

int

The age based on the specified then at the moment of compare.

GetAge(EssentialsDate)

Static

Returns the age as calculated between then and the current date.

public static int GetAge(EssentialsDate then)

Parameters

The date of birth.

Returns

int

The age calculated between the current date and then.

GetAge(EssentialsDate, DateTime)

Static

Returns the age as calculated between the two dates then and compare.

public static int GetAge(EssentialsDate then, DateTime compare)

Parameters

The date of birth.

compare DateTime

The date to compare against.

Returns

int

The calculated age between the two dates.

GetAge(EssentialsDate, DateTimeOffset)

Static

Returns the age as calculated between the two dates then and compare.

public static int GetAge(EssentialsDate then, DateTimeOffset compare)

Parameters

The date of birth.

compare DateTimeOffset

The date to compare against.

Returns

int

The calculated age between the two dates.

GetAge(EssentialsDate, EssentialsDate)

Static

Returns the age as calculated between the two dates then and compare.

public static int GetAge(EssentialsDate then, EssentialsDate compare)

Parameters

The date of birth.

compare EssentialsDate

The date to compare against.

Returns

int

The calculated age between the two dates.

GetAge(EssentialsDate, EssentialsDateTime)

Static

Returns the age as calculated between the two dates then and compare.

public static int GetAge(EssentialsDate then, EssentialsDateTime compare)

Parameters

The date of birth.

The date to compare against.

Returns

int

The calculated age between the two dates.

GetAge(EssentialsDate, EssentialsTime)

Static

Returns the age as calculated between the two dates then and compare.

public static int GetAge(EssentialsDate then, EssentialsTime compare)

Parameters

The date of birth.

compare EssentialsTime

The date to compare against.

Returns

int

The calculated age between the two dates.

GetAge(EssentialsDateTime)

Static

Returns the age as calculated between then and the current date.

public static int GetAge(EssentialsDateTime then)

Parameters

The date of birth.

Returns

int

The age calculated between the current date and then.

GetAge(EssentialsDateTime, DateTime)

Static

Returns the age as calculated between the two dates then and compare.

public static int GetAge(EssentialsDateTime then, DateTime compare)

Parameters

The date of birth.

compare DateTime

The date to compare against.

Returns

int

The calculated age between the two dates.

GetAge(EssentialsDateTime, DateTimeOffset)

Static

Returns the age as calculated between the two dates then and compare.

public static int GetAge(EssentialsDateTime then, DateTimeOffset compare)

Parameters

The date of birth.

compare DateTimeOffset

The date to compare against.

Returns

int

The calculated age between the two dates.

GetAge(EssentialsDateTime, EssentialsDate)

Static

Returns the age as calculated between the two dates then and compare.

public static int GetAge(EssentialsDateTime then, EssentialsDate compare)

Parameters

The date of birth.

compare EssentialsDate

The date to compare against.

Returns

int

The calculated age between the two dates.

GetAge(EssentialsDateTime, EssentialsDateTime)

Static

Returns the age as calculated between the two dates then and compare.

public static int GetAge(EssentialsDateTime then, EssentialsDateTime compare)

Parameters

The date of birth.

The date to compare against.

Returns

int

The calculated age between the two dates.

GetAge(EssentialsDateTime, EssentialsTime)

Static

Returns the age as calculated between the two dates then and compare.

public static int GetAge(EssentialsDateTime then, EssentialsTime compare)

Parameters

The date of birth.

compare EssentialsTime

The date to compare against.

Returns

int

The calculated age between the two dates.

GetAge(EssentialsTime)

Static

Returns the age as calculated between then and the current date.

public static int GetAge(EssentialsTime then)

Parameters

The date of birth.

Returns

int

The age calculated between the current date and then.

GetAge(EssentialsTime, DateTime)

Static

Returns the age as calculated between the two dates then and compare.

public static int GetAge(EssentialsTime then, DateTime compare)

Parameters

The date of birth.

compare DateTime

The date to compare against.

Returns

int

The calculated age between the two dates.

GetAge(EssentialsTime, DateTimeOffset)

Static

Returns the age as calculated between the two dates then and compare.

public static int GetAge(EssentialsTime then, DateTimeOffset compare)

Parameters

The date of birth.

compare DateTimeOffset

The date to compare against.

Returns

int

The calculated age between the two dates.

GetAge(EssentialsTime, EssentialsDate)

Static

Returns the age as calculated between the two dates then and compare.

public static int GetAge(EssentialsTime then, EssentialsDate compare)

Parameters

The date of birth.

compare EssentialsDate

The date to compare against.

Returns

int

The calculated age between the two dates.

GetAge(EssentialsTime, EssentialsDateTime)

Static

Returns the age as calculated between the two dates then and compare.

public static int GetAge(EssentialsTime then, EssentialsDateTime compare)

Parameters

The date of birth.

The date to compare against.

Returns

int

The calculated age between the two dates.

GetAge(EssentialsTime, EssentialsTime)

Static

Returns the age as calculated between the two dates then and compare.

public static int GetAge(EssentialsTime then, EssentialsTime compare)

Parameters

The date of birth.

compare EssentialsTime

The date to compare against.

Returns

int

The calculated age between the two dates.