EssentialsTime Class

Version 1.1.28
.NET Framework 4.8
Namespace Skybrud.Essentials.Time
Assembly Skybrud.Essentials.dll
Visibility Public
Interfaces IComparable , IComparable<T>, IComparable<T>
Inheritance Object

Class wrapping an instance of DateTimeOffset (as an alternative to using Nullable<T>).

public class EssentialsTime : IComparable, IComparable<T>, IComparable<T> { }

Properties

Type Name Summary
EssentialsTime Now

Gets a EssentialsTime object that is set to the current date and time on this computer, expressed as the local time.

EssentialsTime Today

Gets an instance of EssentialsTime representing the current date, according to the local time.

EssentialsTime UtcNow

Gets a EssentialsTime object that is set to the current date and time on this computer, expressed as the Coordinated Universal Time (UTC).

EssentialsTime MinValue

Represents the earliest possible EssentialsTime value.

EssentialsTime MaxValue

Represents the greatest possible value of EssentialsTime.

EssentialsTime Zero

Gets an instance of EssentialsTime representing the start of the Unix Epoch (AKA 0 seconds).

TimeZoneInfo TimeZone

Gets the time zone.

bool HasTimeZone

Gets whether this EssentialsTime has a reference to a specific time zone.

DateTimeOffset DateTimeOffset

Gets the wrapped EssentialsTime.DateTimeOffset.

int Day

Returns the day-of-month part of this EssentialsTime. The returned value is an integer between 1 and 31.

DayOfWeek DayOfWeek

Returns the day-of-week part of this EssentialsTime. The returned value is an integer between 0 and 6, where 0 indicates Sunday, 1 indicates Monday, 2 indicates Tuesday, 3 indicates Wednesday, 4 indicates Thursday, 5 indicates Friday, and 6 indicates Saturday.

int DayOfYear

Gets the day-of-year part of this EssentialsTime. The returned value is an integer between 1 and 366.

int YearAndDay

Returns a numeric value representing both the year and date.

int Hour

Gets the hour part of this EssentialsTime. The returned value is an integer between 0 and 23.

int Millisecond

Gets the millisecond part of this EssentialsTime. The returned value is an integer between 0 and 999.

int Minute

Gets the minute part of this EssentialsTime. The returned value is an integer between 0 and 59.

int Month

Gets the month part of this EssentialsTime. The returned value is an integer between 1 and 12.

int Second

Gets the second part of this EssentialsTime. The returned value is an integer between 0 and 59.

long Ticks

Gets the tick count for this EssentialsTime. The returned value is the number of 100-nanosecond intervals that have elapsed since 1/1/0001 12:00am.

TimeSpan TimeOfDay

Gets the time-of-day part of this EssentialsTime. The returned value is a TimeSpan that indicates the time elapsed since midnight.

int Year

Gets the year part of this EssentialsTime. The returned value is an integer between 1 and 9999.

long UnixTimestamp

Gets the UNIX timestamp (amount of seconds since the start of the Unix Epoch) for this EssentialsTime.

TimeSpan Offset

Gets the time's offset from Coordinated Universal Time (UTC).

bool IsLeapYear

Gets whether the year of this EssentialsTime is a leap year.

bool IsWeekend

Gets whether the day of this EssentialsTime is within a weekend.

bool IsWeekday

Gets whether the day of this EssentialsTime is a weekday.

int WeekNumber

Gets the week number the ISO 8601 week of this EssentialsTime.

int DaysInMonth

Gets the amount of days in the month.

String DaySuffix

Gets the English ordinal suffix of the day.

bool IsZero

Gets whether the Unix timestamp of this EssentialsTime is 0.

bool IsNegative

Gets whether the Unix timestamp of this EssentialsTime is less than 0.

bool IsPositive

Gets whether the Unix timestamp of this EssentialsTime is greater than 0.

bool IsToday

Gets whether the date of this EssentialsTime matches the current day.

bool IsTomorrow

Gets whether the date of this EssentialsTime matches the day after the current day.

bool IsYesterday

Gets whether the date of this EssentialsTime matches the day before the current day.

String Iso8601

Gets a string representation of the instance as specified by the ISO 8601 format.

String Rfc822

Gets a string representation of the instance as specified by the RFC 822 format.

String Rfc2822

Gets a string representation of the instance as specified by the RFC 2822 format.

String DayName

Gets the English name of the day.

String AbbreviatedDayName

Gets the abbreviated English name of the day.

String LocalDayName

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

String AbbreviatedLocalDayName

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

String MonthName

Gets the English name of the month.

String AbbreviatedMonthName

Gets the abbreviated English name of the month.

String LocalMonthName

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

String AbbreviatedLocalMonthName

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

Methods

Returns a new EssentialsTime that adds the value of the specified TimeSpan to the value of this instance.

Returns a new EssentialsTime that adds the specified number of days to the value of this instance.

Returns a new EssentialsTime that adds the specified number of hours to the value of this instance.

Returns a new EssentialsTime that adds the specified number of milliseconds to the value of this instance.

Returns a new EssentialsTime that adds the specified number of minutes to the value of this instance.

Returns a new EssentialsTime that adds the specified number of months to the value of this instance.

Returns a new EssentialsTime that adds the specified number of seconds to the value of this instance.

Returns a new EssentialsTime that adds the specified number of ticks to the value of this instance.

Returns a new EssentialsTime that adds the specified number of years to the value of this instance.

Compares the value of this instance to a specified DateTimeOffset value and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateTimeOffset value.

Compares the value of this instance to a specified EssentialsTime value and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified EssentialsTime value.

CompareTo(object) (virtual)

Compares the value of this instance to a specified object that contains a specified DateTimeOffset value, and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified DateTimeOffset value.

Equals(object) (virtual)

Gets whether this EssentialsTime equals the specified obj.

Convert the specified ISO 8601 string to an instance of EssentialsTime.

Gets an instance of EssentialsTime representing the start of the specified ISO 8601week.

Gets an instance of EssentialsTime representing the start of the specified ISO 8601week.

Gets an instance of EssentialsTime representing the start of the specified ISO 8601week.

Convert the specified RFC 2822 string to an instance of EssentialsTime.

Convert the specified RFC 822 string to an instance of EssentialsTime.

Converts the specified year, month, day and Swatch Internet Time beats into an instance of EssentialsTime.

Converts the specified year, month, day and Swatch Internet Time beats into an instance of EssentialsTime.

Converts the specified date and Swatch Internet Time beats into an instance of EssentialsTime.

Converts the specified date and Swatch Internet Time beats into an instance of EssentialsTime.

FromTicks(long) (static)

Creates a new EssentialsTime instance from the specified amount of ticks.

Creates a new EssentialsTime instance from the specified amount of ticks and offset.

Initialize a new instance from the specified UNIX timestamp.

Initialize a new instance from the specified UNIX timestamp.

Initialize a new instance from the specified UNIX timestamp.

Gets a new instance of EssentialsTime representing the end of the day.

Gets a new instance of EssentialsTime representing the end of the day.

The end of the day will be adjusted according to the time zone and daylight saving.

Gets a new instance of EssentialsTime representing the end of the month.

Gets a new instance of EssentialsTime representing the end of the month.

The end of the month will be adjusted according to the time zone and daylight saving.

Gets a new instance of EssentialsTime representing the end of the week.

Gets a new instance of EssentialsTime representing the end of the week.

The end of the week will be adjusted according to the time zone and daylight saving.

GetHashCode() (virtual)

Gets the hash code for this EssentialsTime.

Gets a new instance of EssentialsTime representing the start of the day.

If EssentialsTime.TimeZone is present, the start of the day will be adjusted according to the time zone and daylight saving.

Gets a new instance of EssentialsTime representing the start of the day.

The start of the day will be adjusted according to the time zone and daylight saving.

Gets a new instance of EssentialsTime representing the start of the month.

If EssentialsTime.TimeZone is present, the start of the month will be adjusted according to the time zone and daylight saving.

Gets a new instance of EssentialsTime representing the start of the month.

The start of the month will be adjusted according to the time zone and daylight saving.

Gets a new instance of EssentialsTime representing the start of the week.

If EssentialsTime.TimeZone is present, the start of the week will be adjusted according to the time zone and daylight saving.

Gets a new instance of EssentialsTime representing the start of the week.

The start of the week will be adjusted according to the time zone and daylight saving.

Adds date and timespan.

Gets whether the timestamps represented by two instances of EssentialsTime are equal.

Gets whether d1 is greater than d2.

Gets whether d1 is greater than or equal to d2.

Initializes a new instance of EssentialsTime from the specified timestamp.

Initializes a new instance of EssentialsTime from the specified timestamp.

Initializes a new instance of EssentialsDateTime from the specified timestamp.

Initializes a new instance of EssentialsTime from the specified timestamp.

Gets whether the timestamps represented by two instances of EssentialsTime are different from each other.

Gets whether d1 is less than d2.

Gets whether d1 is less than or equal to d2.

Subtracts timespan from date.

Subtracts two instances of EssentialsTime.

Parse(string) (static)

Parses the specified string into an instance of EssentialsTime.

Parses the specified string into an instance of EssentialsTime.

Parses the specified string into an instance of EssentialsTime.

Subtracts the specified date and time from this instance.

Subtracts the specified date and time from this instance.

Converts the current EssentialsTime to another instance of EssentialsTime that represents the local time.

Converts the value of the current EssentialsTime object to the date and time specified by an offset value.

ToString() (virtual)

Converts the value of the current EssentialsTime to its equivalent string representation.

Converts the value of the current EssentialsTime to its equivalent string representation using the specified provider.

Converts the value of the current EssentialsTime to its equivalent string representation using the specified format.

Converts the value of the current EssentialsTime to its equivalent string representation using the specified format and provider.

Converts the value of the current EssentialsTime to the corresponding date according to the specified timeZone.

Converts the current EssentialsTime to another instance of EssentialsTime that represents the Coordinated Universal Time (UTC).

Converts the specified string representation of a date and time to its EssentialsTime equivalent and returns a value that indicates whether the conversion succeeded.

Tries to convert a specified string representation of a date and time to its EssentialsTime equivalent, and returns a value that indicates whether the conversion succeeded.

Converts the specified iso8601 formatted date and time to its EssentialsTime equivalent and returns a value that indicates whether the conversion succeeded.

Converts the specified rfc2822 formatted date and time to its EssentialsTime equivalent and returns a value that indicates whether the conversion succeeded.

Converts the specified rfc822 formatted date and time to its EssentialsTime equivalent and returns a value that indicates whether the conversion succeeded.