DateTimeExtensions Class

Namespace:
Weavy.Core.Helpers
Assembly:
Weavy.Core.dll

Helper and extension methods for dates and times.

public static class DateTimeExtensions
Inheritance:
System.Object → DateTimeExtensions

Methods

From(DateTime, DateTime, Boolean) Returns a textual representation of a date relative to another date.
FromNow(DateTime, Boolean) Returns a textual representation of the specified date from now. This is sometimes called "time ago" or "relative time".
FromNow(NullableTime>) Returns a textual representation of the specified date from now. This is sometimes called "time ago" or "relative time".
IsBetween(DateTime, DateTime, DateTime) Check if date is between the two dates a and b.
NextFrom(CrontabSchedule, NullableTime>) Gets the next occurrence of this schedule starting with a base time.
ToLocal(DateTime) Converts an UTC date to local server/user time.
ToLocal(NullableTime>) Converts an UTC date to local server/user time.
ToShortDateString(NullableTime>) Converts a datetime object to its short date string representation.
ToString(NullableTime>, String) Converts a datetime object to string.
ToUnixTime(DateTime) Gets the current Unix time for the specified date (UTC), i.e. the number of seconds since 1970-01-01T00:00:00Z.
ToUtc(DateTime) Converts a local time to UTC.
When(DateTime, Boolean) Returns a textual representation when the specified date occured, e.g. "4:38 PM", "Yesterday", "Wednesday", "June 16", "10/06/16" etc.