|
PeanutButter
|
Provides some useful extension methods for DateTime values. More...
Static Public Member Functions | |
| static bool | IsWithinRange (this DateTime value, DateTime start, DateTime end) |
| Calculates whether or not a provided DateTime is within the provided range. | |
| static string | AsHoursAndMinutes (this DateTime value) |
| Returns a string representation of the form HH:mm for a DateTime. | |
| static string | AsTimeString (this DateTime value) |
| Returns a string representation of the form HH:mm:ss for a DateTime. | |
| static long | MillisecondsSinceStartOfDay (this DateTime value) |
| Calculates the number of milliseconds since the start of the day for a given DateTime value. | |
| static DateTime | StartOfDay (this DateTime value) |
| Calculates the DateTime of the start of the day for a provided DateTime value. | |
| static DateTimeOffset | StartOfDay (this DateTimeOffset value) |
| Returns the start of day for a DateTimeOffset. | |
| static DateTime | EndOfDay (this DateTime value) |
| Calculates the DateTime of the end of the day for a provided DateTime value. | |
| static DateTime | AsTimeOnly (this DateTime value) |
| Gets a DateTime value which has the same time components as the provided subject with minimum values (typically 0 or 1) for the date components. | |
| static DateTime | WithTime (this DateTime value, int hour, int minute, int second, int millisecond=0) |
| Gets a new DateTime with the time component mutated. | |
| static DateTime | WithTime (this DateTime value, TimeSpan time) |
| Produces a new DateTime with the time mutated to the time specified by the provided TimeSpan, clamped to within 24 hours. | |
| static DateTime | TruncateMicroseconds (this DateTime value) |
| Provides a new DateTime with all components from the subject except Microseconds, which are truncated. | |
| static DateTime | TruncateMilliseconds (this DateTime value) |
| Provides a new DateTime with all components from the subject except Milliseconds, which are truncated. | |
| static DateTime | ToKind (this DateTime value, DateTimeKind kind) |
| Provides a new DateTime object with the DateTimeKind set as required. | |
| static DateTime | WithKind (this DateTime value, DateTimeKind kind) |
| Provides a new DateTime object with the DateTimeKind set as required. Note that this doesn't convert DateTime objects between, eg UTC and Local times: the. | |
| static bool | IsBetween (this DateTime subject, DateTime before, DateTime after) |
| Returns true when the subject date-time is between the provided before and after values. | |
| static DateTime | TruncateSeconds (this DateTime value) |
| Provides a new DateTime with all components from the subject except Seconds, which are truncated. | |
| static DateTime | TruncateMinutes (this DateTime value) |
| Provides a new DateTime with all components from the subject except Minutes, which are truncated. | |
| static DateTime | TruncateHours (this DateTime value) |
| Provides a new DateTime with all components from the subject except Hours, which are truncated. | |
| static DateTime | TruncateDays (this DateTime value) |
| Provides a new DateTime with all components from the subject except Days, which are truncated. | |
| static DateTime | TruncateMonths (this DateTime value) |
| Provides a new DateTime with all components from the subject except Months, which are truncated. | |
| static int | Microseconds (this DateTime value) |
| Gets the microseconds component for a DateTime value. | |
Provides some useful extension methods for DateTime values.
|
static |
Returns a string representation of the form HH:mm for a DateTime.
| value | Datetime subject |
|
static |
Gets a DateTime value which has the same time components as the provided subject with minimum values (typically 0 or 1) for the date components.
| value | Subject DateTime to operate on |
|
static |
Returns a string representation of the form HH:mm:ss for a DateTime.
| value | Datetime subject |
|
static |
Calculates the DateTime of the end of the day for a provided DateTime value.
| value | Subject DateTime to calculate the end of day for |
|
static |
Returns true when the subject date-time is between the provided before and after values.
| subject | |
| before | |
| after |
|
static |
Calculates whether or not a provided DateTime is within the provided range.
| value | DateTime subject to test |
| start | Minimum value of DateTime range |
| end | MaximumValue of DateTime range |
|
static |
Gets the microseconds component for a DateTime value.
| value | Subject DateTime to operate on |
|
static |
Calculates the number of milliseconds since the start of the day for a given DateTime value.
| value | DateTime subject to calculate for |
|
static |
Calculates the DateTime of the start of the day for a provided DateTime value.
| value | Subject DateTime to calculate the start of day for |
|
static |
Returns the start of day for a DateTimeOffset.
| value |
|
static |
Provides a new DateTime object with the DateTimeKind set as required.
| value | |
| kind |
|
static |
Provides a new DateTime with all components from the subject except Days, which are truncated.
| value | Subject DateTime to start with |
|
static |
Provides a new DateTime with all components from the subject except Hours, which are truncated.
| value | Subject DateTime to start with |
|
static |
Provides a new DateTime with all components from the subject except Microseconds, which are truncated.
| value | Subject DateTime to start with |
|
static |
Provides a new DateTime with all components from the subject except Milliseconds, which are truncated.
| value | Subject DateTime to start with |
|
static |
Provides a new DateTime with all components from the subject except Minutes, which are truncated.
| value | Subject DateTime to start with |
|
static |
Provides a new DateTime with all components from the subject except Months, which are truncated.
| value | Subject DateTime to start with |
|
static |
Provides a new DateTime with all components from the subject except Seconds, which are truncated.
| value | Subject DateTime to start with |
|
static |
Provides a new DateTime object with the DateTimeKind set as required. Note that this doesn't convert DateTime objects between, eg UTC and Local times: the.
| value | |
| kind |
|
static |
Gets a new DateTime with the time component mutated.
| value | Subject DateTime to start with |
| hour | Hours to set on result |
| minute | Minutes to set on result |
| second | Seconds to set on result |
| millisecond | Milliseconds to set on result |
|
static |
Produces a new DateTime with the time mutated to the time specified by the provided TimeSpan, clamped to within 24 hours.
| value | Subject DateTime to start with |
| time | Required time |