DateTimeExtension extension

Extension on the DateTime class providing additional functionality related to date and time.

on

Properties

isThisYear bool
Indicates whether the DateTime object belongs to the same year as the current date and time.
no setter
isToday bool
Indicates whether the DateTime object represents today's date.
no setter
isYesterday bool
Indicates whether the DateTime object represents yesterday's date.
no setter

Methods

isAfterOrEqual(DateTime dateTime) bool
Checks if the current DateTime instance is after or equal to the given dateTime. Returns true if it is, false otherwise.
isBeforeOrEqual(DateTime dateTime) bool
Checks if the current DateTime instance is before or equal to the given dateTime. Returns true if it is, false otherwise.
isBetween(DateTime fromDateTime, DateTime toDateTime) bool
Checks if the current DateTime instance falls between the provided fromDateTime and toDateTime.
isSameDay(DateTime date) bool
Indicates whether two DateTime objects are on the same day.
isSameMonth(DateTime date) bool
Indicates whether two DateTime objects are in the same month.
isSameYear(DateTime date) bool
Indicates whether two DateTime objects are in the same year.