DateTimeFormatting extension

on

Properties

calculateAge int

Available on DateTime, provided by the DateTimeFormatting extension

The calculateAge property calculates the age of a person based on their birthdate. It takes the current date into account and returns the person's age in years.
no setter

Methods

addDays(int days) DateTime

Available on DateTime, provided by the DateTimeFormatting extension

addDays(): Adds a specified number of days to a DateTime.
addHours(int hours) DateTime

Available on DateTime, provided by the DateTimeFormatting extension

addHours(): Adds a specified number of hours to a DateTime.
addMilliseconds(int milliseconds) DateTime

Available on DateTime, provided by the DateTimeFormatting extension

addMilliseconds(): Adds a specified number of milliseconds to a DateTime.
addMinutes(int minutes) DateTime

Available on DateTime, provided by the DateTimeFormatting extension

addMinutes(): Adds a specified number of minutes to a DateTime.
addMonths(int months) DateTime

Available on DateTime, provided by the DateTimeFormatting extension

addMonths(): Adds a specified number of months to a DateTime.
addSeconds(int seconds) DateTime

Available on DateTime, provided by the DateTimeFormatting extension

addSeconds(): Adds a specified number of seconds to a DateTime.
addWeekdaysBySkippingWeekends(int daysToAdd) DateTime

Available on DateTime, provided by the DateTimeFormatting extension

addYears(int years) DateTime

Available on DateTime, provided by the DateTimeFormatting extension

addYears(): Adds a specified number of years to a DateTime.
formatDate({required String likeGiven}) String?

Available on DateTime, provided by the DateTimeFormatting extension

formatDate(): Formats a DateTime object using a specified format string. The likeGiven parameter is used to provide a format hint, and the function detects the appropriate format based on the string's contents.
subtractDays(int days) DateTime

Available on DateTime, provided by the DateTimeFormatting extension

subtractDays(): Subtracts a specified number of days from a DateTime.
subtractHours(int hours) DateTime

Available on DateTime, provided by the DateTimeFormatting extension

subtractHours(): Subtracts a specified number of hours from a DateTime.
subtractMilliseconds(int milliseconds) DateTime

Available on DateTime, provided by the DateTimeFormatting extension

subtractMilliseconds(): Subtracts a specified number of milliseconds from a DateTime.
subtractMinutes(int minutes) DateTime

Available on DateTime, provided by the DateTimeFormatting extension

subtractMinutes(): Subtracts a specified number of minutes from a DateTime.
subtractMonths(int months) DateTime

Available on DateTime, provided by the DateTimeFormatting extension

subtractMonths(): Subtracts a specified number of months from a DateTime.
subtractSeconds(int seconds) DateTime

Available on DateTime, provided by the DateTimeFormatting extension

subtractSeconds(): Subtracts a specified number of seconds from a DateTime.
subtractYears(int years) DateTime

Available on DateTime, provided by the DateTimeFormatting extension

subtractYears(): Subtracts a specified number of years from a DateTime.
to12HourTime() String

Available on DateTime, provided by the DateTimeFormatting extension

Format DateTime as 12-Hour Time with AM/PM: hh:MM:SS AM/PM
to24HourTime() String

Available on DateTime, provided by the DateTimeFormatting extension

Format DateTime as 24-Hour Time: HH:MM:SS
toIso8601() String

Available on DateTime, provided by the DateTimeFormatting extension

Format DateTime as ISO 8601
toLongDate() String

Available on DateTime, provided by the DateTimeFormatting extension

Format DateTime as Long Date: Month DD, YYYY
toShortDate() String

Available on DateTime, provided by the DateTimeFormatting extension

Format DateTime as Short Date: MM/DD/YYYY
weeksInMonth() int

Available on DateTime, provided by the DateTimeFormatting extension

weeksInMonth(): Calculates the number of weeks in the month of a DateTime.