DateTimeUtils class

A utility class for working with DateTime objects.

Constructors

DateTimeUtils.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

calculateAgeAtDeath({required DateTime? dob, required DateTime? dod}) int?
Calculates the age at death based on the date of birth (DOB) and date of death (DOD).
convertDaysToYearsAndMonths(int? days) String?
Function to convert an integer representing days into a string format of years and months.
extractYear(String input) int?
Extracts a 4-digit year from a given string.
firstDayNextMonth({required int month, required int year}) DateTime?
Calculates the first day of the next month for a given month and year.
isDeviceDateMonthFirst() bool
Method to check if the device date format is month first.
isLeapYear({required int year}) bool
Checks if the given year is a leap year.
maxDate(DateTime date1, DateTime? date2) DateTime
Returns the later of two dates.
minDate(DateTime date1, DateTime? date2) DateTime
Returns the earlier of two dates.
monthDayCount({required int year, required int month}) int
Returns the number of days in the given month and year.
tomorrow({DateTime? now, int? hour, int? minute = 0, int? second = 0}) DateTime
Returns the date for tomorrow at the specified time.