TimeUtils Class

Version 1.1.28
.NET Framework 4.8
Namespace Skybrud.Essentials.Time
Assembly Skybrud.Essentials.dll
Visibility Public
Keywords Static
Inheritance Object

Utility class with various static helper methods for working with date and time.

public static class TimeUtils { }

Fields

Type Name Value Summary
string Iso8601DateFormat yyyy-MM-ddTHH:mm:ssK

ISO 8601 date format.

Methods

Gets the abbreviated English name of the day.

Gets the abbreviated English name of the day.

Gets the abbreviated English name of the day.

Gets the abbreviated name of the day according to the current culture.

Gets the abbreviated name of the day according to the current culture.

Gets the abbreviated name of the day according to the current culture.

Gets the abbreviated name of the day according to culture.

Gets the abbreviated name of the day according to culture.

Gets the abbreviated name of the day according to culture.

Gets the abbreviated name of the month according to the current culture.

Gets the abbreviated name of the month according to the current culture.

Gets the abbreviated name of the month according to the current culture.

Gets the abbreviated name of the month according to culture.

Gets the abbreviated name of the month according to culture.

Gets the abbreviated name of the month according to culture.

Gets the abbreviated English name of the specified month.

Gets the abbreviated English name of the month.

Gets the abbreviated English name of the month.

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

Returns the age as calculated between two dates.

GetAge(DateTime) (static)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Returns the current Unix timestamp which is defined as the amount of seconds since the start of the Unix epoch - that is 1st of January, 1970 - 00:00:00 GMT.

Returns the current Unix timestamp which is defined as the amount of seconds since the start of the Unix epoch - that is 1st of January, 1970 - 00:00:00 GMT.

Gets an instance of DateTime representing the start of the specified ISO 8601year and week.

Returns an instance of DateTime based on the amount of seconds since the start of the Unix epoch - that is 1st of January, 1970 - 00:00:00 GMT.

Returns an instance of DateTime based on the amount of seconds since the start of the Unix epoch - that is 1st of January, 1970 - 00:00:00 GMT.

Returns an instance of DateTime based on the amount of seconds since the start of the Unix epoch - that is 1st of January, 1970 - 00:00:00 GMT.

Returns an instance of DateTime based on the amount of seconds since the start of the Unix epoch - that is 1st of January, 1970 - 00:00:00 GMT.

Gets an instance of DateTimeOffset representing the start of the specified ISO 8601year and week.

Gets an instance of DateTimeOffset representing the start of the specified ISO 8601year and week.

Returns an instance of DateTimeOffset based on the amount of seconds since the start of the Unix epoch - that is 1st of January, 1970 - 00:00:00 GMT.

Returns an instance of DateTimeOffset based on the amount of seconds since the start of the Unix epoch - that is 1st of January, 1970 - 00:00:00 GMT.

Returns an instance of DateTimeOffset based on the amount of seconds since the start of the Unix epoch - that is 1st of January, 1970 - 00:00:00 GMT.

Returns an instance of DateTimeOffset based on the amount of seconds since the start of the Unix epoch - that is 1st of January, 1970 - 00:00:00 GMT.

Gets the English name of the day.

Gets the English name of the day.

Gets the English name of the day.

Gets the day of the month along with the English ordinal suffix based on the specified date.

Gets the day of the month along with the English ordinal suffix based on the specified date.

Gets the English ordinal suffix of the day based on the specified date.

Gets the English ordinal suffix of the day based on the specified date.

Gets the elapsed seconds since the specified date.

Gets the elapsed seconds since the specified date.

Gets the first day of the month of the specified date.

Gets the first day of the month of the specified date.

Gets the first day of the week of the specified date. Monday is considered the first day of the week.

Gets the first day of the week of the specified date. Monday is considered the first day of the week.

Gets the first day of the week of the specified date and based on startOfWeek.

Gets the first day of the week of the specified date and based on startOfWeek.

Gets the first day of the month that matches dayOfWeek.

Gets the first day of the month that matches dayOfWeek..

Gets the first day of the month that matches dayOfWeek..

Gets the first day of the month that matches dayOfWeek..

Gets the first day of the month that matches dayOfWeek..

Gets the first day of the month that matches dayOfWeek..

Gets the week number of date according to the ISO 8601 specification.

Gets the week number of date according to the ISO 8601 specification.

Gets the last day of the month of the specified date.

Gets the last day of the month of the specified date.

Gets the last day of the week of the specified date. Monday is considered the first day of the week.

Gets the last day of the week of the specified date. Monday is considered the first day of the week.

Gets the last day of the week of the specified date and based on startOfWeek.

Gets the last day of the week of the specified date and based on startOfWeek.

Gets the last day of the month that matches dayOfWeek..

Gets the last day of the month that matches dayOfWeek..

Gets the last day of the month that matches dayOfWeek..

Gets the last day of the month that matches dayOfWeek..

Gets the last day of the month that matches dayOfWeek..

Gets the last day of the month that matches dayOfWeek..

Gets the name of the day according to the current culture.

Gets the name of the day according to the current culture.

Gets the name of the day according to the current culture.

Gets the name of the day according to culture.

Gets the name of the day according to culture.

Gets the name of the day according to culture.

Gets the name of the month according to the current culture.

Gets the name of the month according to the current culture.

Gets the name of the month according to the current culture.

Gets the name of the month according to culture.

Gets the name of the month according to culture.

Gets the name of the month according to culture.

Gets the English name of the specified month.

Gets the English name of the month.

Gets the English name of the month.

Returns the Unix timestamp for the specified date. The Unix timestamp is defined as the amount of seconds since the start of the Unix epoch - that is 1st of January, 1970 - 00:00:00 GMT.

Returns the Unix timestamp for the specified date. The Unix timestamp is defined as the amount of seconds since the start of the Unix epoch - that is 1st of January, 1970 - 00:00:00 GMT.

Returns the Unix timestamp for the specified date. The Unix timestamp is defined as the amount of seconds since the start of the Unix epoch - that is 1st of January, 1970 - 00:00:00 GMT.

Returns the Unix timestamp for the specified date. The Unix timestamp is defined as the amount of seconds since the start of the Unix epoch - that is 1st of January, 1970 - 00:00:00 GMT.

Returns whether date is within the last number of specified days.

Returns whether date is within the last number of specified days.

Gets whether the specified date is a leap year.

Gets whether the specified date is a leap year.

IsLeapYear(int) (static)

Gets whether the specified year is a leap year.

Converts the specified iso8601 date to an instance of DateTime .

Converts the specified iso8601 date to an instance of DateTimeOffset .

Gets whether the specified date is a weekday.

Gets whether the specified date is a weekday.

Gets whether the specified date is in the weekend.

Gets whether the specified date is in the weekend.

The RFC 822 specification describes a number of predefined time zones - eg. EST (Eastern Standard Time), UT (Universal Time) and GMT (Greenwich Mean Time) - which DateTimeOffset isn't able to parse on it's own, so we need to convert the time zone to an offset instead - eg +01:00.

Converts the specified monthName into the an instance of EssentialsDateMonthName (eg. August will be converted to August).

Converts the specified monthName into the an instance of EssentialsDateMonthName (eg. August will be converted to August).

Converts the specified monthName into the numerical representation of the month (eg. August is the eight month of the year, and will result in 8).

Converts the specified monthName into the numerical representation of the month (eg. August is the eight month of the year, and will result in 8).

Converts the specified rfc822 date to an instance of DateTime .

Converts the specified rfc822 date to an instance of DateTimeOffset .

Converts the specified timestamp to a string representation as specified by the ISO 8601 format.

Converts the specified timestamp to a string representation as specified by the ISO 8601 format.

Converts the specified timestamp to a string representation as specified by the ISO 8601 format.

Converts the specified timestamp to a string representation as specified by the RFC 2822 format.

Converts the specified timestamp to a string representation as specified by the RFC 2822 format.

Converts the specified timestamp to a string representation as specified by the RFC 2822 format.

Converts the specified timestamp to a string representation as specified by the RFC 822 format.

Converts the specified timestamp to a string representation as specified by the RFC 822 format.

Converts the specified timestamp to a string representation as specified by the RFC 822 format.

Converts the specified monthName into an enum representation of the month (eg. August is the eight month of the year, and will result in August) and returns a value that indicates whether the conversion succeeded.

Converts the specified monthName into an enum representation of the month (eg. August is the eight month of the year, and will result in August) and returns a value that indicates whether the conversion succeeded.

Converts the specified monthName into the numerical representation of the month (eg. August is the eight month of the year, and will result in 8) and returns a value that indicates whether the conversion succeeded.

Converts the specified monthName into the numerical representation of the month (eg. August is the eight month of the year, and will result in 8) and returns a value that indicates whether the conversion succeeded.