DateTimeUtils extension
Properties
-
isAfternoon
→ bool
-
Return
true
if is afternoon, false
otherwise.
Afternoon is defined as 12:00 to 17:59.
no setter
-
isEvening
→ bool
-
Return
true
if is evening, false
otherwise.
Evening is between 18 and 22.
no setter
-
isFuture
→ bool
-
Returns
true
if the date is in the future, false
otherwise.
no setter
-
isHoliday
→ bool
-
Return
true
if is holiday, false
otherwise.
Holidays are defined as Saturday and Sunday.
no setter
-
isLeapYear
→ bool
-
Return
true
if is leap year, false
otherwise.
no setter
-
isMorning
→ bool
-
Return
true
if is morning, false
otherwise.
Morning is defined as between 5am and 12pm.
no setter
-
isNight
→ bool
-
Return
true
if is night, false
otherwise.
Night is between 23 and 5.
no setter
-
isPast
→ bool
-
Returns
true
if the date is in the past, false
otherwise.
no setter
-
isToday
→ bool
-
Returns
true
if the date is today, false
otherwise.
no setter
-
isTomorrow
→ bool
-
Returns
true
if the date is tomorrow, false
otherwise.
no setter
-
isWeekday
→ bool
-
Return
true
if is weekday, false
otherwise.
no setter
-
isWeekend
→ bool
-
Return
true
if is weekend, false
otherwise.
no setter
-
isYesterday
→ bool
-
Returns
true
if the date is yesterday, false
otherwise.
no setter
-
season
→ String
-
Return
Season
of the date.
Seasons are defined as:
no setter
Methods
-
daysUntil(DateTime other)
→ int
-
Days until
other
.
If other
is in the past, the result will be negative.
-
daysUntilEndOfYear()
→ int
-
Days until end of year.
-
daysUntilWeekend()
→ int
-
Return days until the weekend.
If the date is in the weekend, the result will be 0.
-
hoursUntil(DateTime other)
→ int
-
Hours until
other
.
If other
is in the past, the result will be negative.
-
isAheadByDays(DateTime other, int days)
→ bool
-
Return
true
if the date is ahead of other
by days
, false
otherwise.
-
isBehindByDays(DateTime other, int days)
→ bool
-
Return
true
if the date is behind of other
by days
, false
otherwise.
-
isInSeason(String season)
→ bool
-
Return
true
if is in season
, false
otherwise.
-
isSameDay(DateTime other)
→ bool
-
Returns
true
if the date is in the same day as other
, false
otherwise.
-
isSameHour(DateTime other)
→ bool
-
Returns
true
if the date is in the same hour as other
, false
otherwise.
-
isSameMillisecond(DateTime other)
→ bool
-
Returns
true
if the date is in the same millisecond as other
, false
otherwise.
-
isSameMinute(DateTime other)
→ bool
-
Returns
true
if the date is in the same minute as other
, false
otherwise.
-
isSameMonth(DateTime other)
→ bool
-
Returns
true
if the date is in the same month as other
, false
otherwise.
-
isSameSecond(DateTime other)
→ bool
-
Returns
true
if the date is in the same second as other
, false
otherwise.
-
isSameYear(DateTime other)
→ bool
-
Returns
true
if the date is in the same year as other
, false
otherwise.