DateTimeExtension extension

on

Properties

isInFuture bool

Available on DateTime, provided by the DateTimeExtension extension

Checks if the current date is in the future
no setter
isInPast bool

Available on DateTime, provided by the DateTimeExtension extension

Checks if the current date is in the past
no setter
isNotNull bool

Available on DateTime, provided by the DateTimeExtension extension

Returns true if the given date is not null.
no setter

Methods

addDays(int amount) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Adds a certain amount of days to this date and returns a new DateTime instance.
addHours(int amount) DateTime

Available on DateTime, provided by the DateTimeExtension extension

Adds a certain amount of hours to this date and returns a new DateTime instance.
asUtc() DateTime?

Available on DateTime, provided by the DateTimeExtension extension

Converts the DateTime object to the UTC timezone.
countDays(DateTime? differenceDateTime) int

Available on DateTime, provided by the DateTimeExtension extension

Calculates the number of days between two DateTime objects.
countHours(DateTime? differenceDateTime) int

Available on DateTime, provided by the DateTimeExtension extension

Calculates the difference in hours between the current DateTime object and differenceDateTime.
countMinutes(DateTime? differenceDateTime) int

Available on DateTime, provided by the DateTimeExtension extension

Converts the time difference to a number of minutes.
countMonths(DateTime? differenceDateTime) int

Available on DateTime, provided by the DateTimeExtension extension

Calculates the number of months between the current DateTime object and differenceDateTime.
countSeconds(DateTime? differenceDateTime) int

Available on DateTime, provided by the DateTimeExtension extension

Converts the time difference to a number of seconds.
countWeeks(DateTime? differenceDateTime) int

Available on DateTime, provided by the DateTimeExtension extension

Counts the number of weeks between the current DateTime and the differenceDateTime.
countYears(DateTime? differenceDateTime) int

Available on DateTime, provided by the DateTimeExtension extension

Calculates the number of years between this DateTime instance and another DateTime instance.
currentTimeStamp() int

Available on DateTime, provided by the DateTimeExtension extension

Returns the current timestamp in seconds.
dateOnly() DateTime

Available on DateTime, provided by the DateTimeExtension extension

Returns a DateTime with the date of the original, but time set to midnight.
firstDayOfMonth() DateTime

Available on DateTime, provided by the DateTimeExtension extension

Returns a DateTime instance representing the first day of the month of this DateTime.
firstDayOfWeek() DateTime

Available on DateTime, provided by the DateTimeExtension extension

Returns a DateTime instance representing the first day of the week of this DateTime.
isFirstDayOfMonth() bool

Available on DateTime, provided by the DateTimeExtension extension

Checks if this DateTime instance represents the first day of the month.
isLastDayOfMonth() bool

Available on DateTime, provided by the DateTimeExtension extension

Checks if this DateTime instance represents the last day of the month.
isSameDay(DateTime b) bool

Available on DateTime, provided by the DateTimeExtension extension

Checks whether two DateTime instances are on the same day.
isSameWeek(DateTime b) bool

Available on DateTime, provided by the DateTimeExtension extension

Checks if two DateTime instances fall within the same week.
isToday() bool

Available on DateTime, provided by the DateTimeExtension extension

Returns true if the given date is today.
isTomorrow() bool

Available on DateTime, provided by the DateTimeExtension extension

Returns true if the given date is tomorrow.
isYesterday() bool

Available on DateTime, provided by the DateTimeExtension extension

Returns true if the given date is yesterday.
lastDayOfMonth() DateTime

Available on DateTime, provided by the DateTimeExtension extension

Returns a DateTime instance representing the last day of the month of this DateTime.
lastDayOfWeek() DateTime

Available on DateTime, provided by the DateTimeExtension extension

Returns a DateTime instance representing the last day of the week of this DateTime.
monthName({bool isHalfName = false}) String

Available on DateTime, provided by the DateTimeExtension extension

Returns Month name of give this DateTime Example: final date = DateTime.now(); //output: 2023-05-24 13:14:23.593304 print(date.monthName()??""); //output: May
nextDay() DateTime

Available on DateTime, provided by the DateTimeExtension extension

Returns a DateTime representing the day after this DateTime.
nextMonth() DateTime

Available on DateTime, provided by the DateTimeExtension extension

Returns a DateTime instance representing the exact date of the next coming month.
nextWeek() DateTime

Available on DateTime, provided by the DateTimeExtension extension

Returns a DateTime instance representing the exact date of the coming week.
previousDay() DateTime

Available on DateTime, provided by the DateTimeExtension extension

Returns a DateTime representing the day before this DateTime.
previousMonth() DateTime

Available on DateTime, provided by the DateTimeExtension extension

Returns a DateTime instance representing the exact date of the previous month.
previousWeek() DateTime

Available on DateTime, provided by the DateTimeExtension extension

Returns a DateTime instance representing the exact date of the previous week.
timeAgo() String

Available on DateTime, provided by the DateTimeExtension extension

Returns the time difference from this DateTime to the current DateTime in Indian language.
toIndiaTimeZone() DateTime?

Available on DateTime, provided by the DateTimeExtension extension

Converts the DateTime object to the Indian time zone.
toTimeAmPm() String

Available on DateTime, provided by the DateTimeExtension extension

Returns the time in AM/PM format for this DateTime.
weekdayName({bool isHalfName = false}) String

Available on DateTime, provided by the DateTimeExtension extension

Returns the name of the weekday for the given date.