DateTimeDext extension

Extensions for DateTime

on

Methods

addTime({int day = 0, int hour = 0, int minute = 0, int second = 0, int millisecond = 0, int microsecond = 0}) DateTime
Add time and return a new DateTime.
copyWith({int? year, int? month, int? day, int? hour, int? minute, int? second, int? millisecond, int? microsecond}) DateTime
CopyWith the DateTime with the year, month, day, hour, minute, second, millisecond, microsecond.
format(String formatText) String
Converts DateTime to format format.
isSameDay(DateTime other) bool
Check if the DateTime is in the same day as the other.
isSameMonth(DateTime other) bool
Check if the DateTime is in the same month as the other.
isSameWeek(DateTime other) bool
Check if the DateTime is in the same week as the other.
isSameYear(DateTime other) bool
Check if the DateTime is in the same year as the other.
simpleDate() String
Converts DateTime to yyyy-MM-dd format.
simpleDateTime() String
Converts DateTime to yyyy-MM-dd HH:mm:ss.
simpleTime() String
Converts DateTime to HH:mm:ss format.
subtractTime({int days = 0, int hours = 0, int minutes = 0, int second = 0, int milliseconds = 0, int microseconds = 0}) DateTime
Subtract time and return a new DateTime.
toZeroHour() DateTime
Converts DateTime to the zero time of the day.