NyDateTime extension
Extensions for DateTime
- on
Methods
-
addDays(
int days) → DateTime -
Available on DateTime?, provided by the NyDateTime extension
Add days to a DateTime -
addHours(
int hours) → DateTime -
Available on DateTime?, provided by the NyDateTime extension
Add hours to a DateTime -
addMinutes(
int minutes) → DateTime -
Available on DateTime?, provided by the NyDateTime extension
-
addMonths(
int months) → DateTime -
Available on DateTime?, provided by the NyDateTime extension
Add months to a DateTime -
addSeconds(
int seconds) → DateTime -
Available on DateTime?, provided by the NyDateTime extension
Add seconds to a DateTime -
addYears(
int years) → DateTime -
Available on DateTime?, provided by the NyDateTime extension
Add years to a DateTime -
dd(
{String? tag}) → dynamic -
Available on DateTime?, provided by the NyDateTime extension
dump the value to the console and exit the app.tag
is optional. -
dump(
{String? tag}) → dynamic -
Available on DateTime?, provided by the NyDateTime extension
dump the value to the console.tag
is optional. -
hasExpired(
) → bool -
Available on DateTime?, provided by the NyDateTime extension
Check if the date is still valid. -
isAfternoon(
) → bool -
Available on DateTime?, provided by the NyDateTime extension
Check if the date is in the afternoon. -
isAgeBetween(
int min, int max) → bool? -
Available on DateTime?, provided by the NyDateTime extension
Check if DateTime is between a certainmin
andmax
age -
isAgeEqualTo(
int age) → dynamic -
Available on DateTime?, provided by the NyDateTime extension
Check if DateTime is equal to a certainage
-
isAgeOlder(
int age) → bool? -
Available on DateTime?, provided by the NyDateTime extension
Check if DateTime is older than a certainage
-
isAgeYounger(
int age) → bool? -
Available on DateTime?, provided by the NyDateTime extension
Check if DateTime is younger than a certainage
-
isEvening(
) → bool -
Available on DateTime?, provided by the NyDateTime extension
Check if the date is in the evening. -
isInFuture(
) → bool -
Available on DateTime?, provided by the NyDateTime extension
Check if DateTime is in the future -
isInPast(
) → bool -
Available on DateTime?, provided by the NyDateTime extension
Check if DateTime is in the past -
isMorning(
) → bool -
Available on DateTime?, provided by the NyDateTime extension
Check if the date is in the morning. -
isNight(
) → bool -
Available on DateTime?, provided by the NyDateTime extension
Check if the date is in the night. -
isSameDay(
DateTime dateTimeToCompare) → bool -
Available on DateTime?, provided by the NyDateTime extension
Check if a date is the same day as another date.dateTime1
anddateTime2
are the dates to compare. -
isToday(
) → bool -
Available on DateTime?, provided by the NyDateTime extension
Check if DateTime is today -
isTomorrow(
) → bool -
Available on DateTime?, provided by the NyDateTime extension
Check if DateTime is tomorrow -
isYesterday(
) → bool -
Available on DateTime?, provided by the NyDateTime extension
Check if DateTime is yesterday -
subtractDays(
int days) → DateTime -
Available on DateTime?, provided by the NyDateTime extension
Subtract days from a DateTime -
subtractHours(
int hours) → DateTime -
Available on DateTime?, provided by the NyDateTime extension
Subtract hours from a DateTime -
subtractMinutes(
int minutes) → DateTime -
Available on DateTime?, provided by the NyDateTime extension
Subtract minutes from a DateTime -
subtractMonths(
int months) → DateTime -
Available on DateTime?, provided by the NyDateTime extension
Subtract months from a DateTime -
subtractSeconds(
int seconds) → DateTime -
Available on DateTime?, provided by the NyDateTime extension
Subtract seconds from a DateTime -
subtractYears(
int years) → DateTime -
Available on DateTime?, provided by the NyDateTime extension
Subtract years from a DateTime -
toAge(
) → int? -
Available on DateTime?, provided by the NyDateTime extension
Format DateTime to an age -
toDateString(
{String format = "yyyy-MM-dd"}) → String? -
Available on DateTime?, provided by the NyDateTime extension
Format DateTime to toDateString - yyyy-MM-dd -
toDateStringUK(
{String format = "dd/MM/yyyy"}) → String? -
Available on DateTime?, provided by the NyDateTime extension
Format DateTime to toDateString - yyyy-MM-dd -
toDateStringUS(
{String format = "MM/dd/yyyy"}) → String? -
Available on DateTime?, provided by the NyDateTime extension
Format DateTime to toDateString - yyyy-MM-dd -
toDateTimeString(
) → String? -
Available on DateTime?, provided by the NyDateTime extension
Format DateTime to DateTimeString - yyyy-MM-dd HH:mm:ss -
toFormat(
String format) → String? -
Available on DateTime?, provided by the NyDateTime extension
Format DateTime -
toShortDate(
) → String -
Available on DateTime?, provided by the NyDateTime extension
Format DateTime to a short date - example "Mon 1st Jan" -
toTimeAgoString(
) → String? -
Available on DateTime?, provided by the NyDateTime extension
-
toTimestamp(
) → String? -
Available on DateTime?, provided by the NyDateTime extension
Format DateTime to Unix timestamp -
toTimeString(
{bool withSeconds = false}) → String? -
Available on DateTime?, provided by the NyDateTime extension
Format DateTime to toTimeString - HH:mm or HH:mm:ss