trait Comparison
Trait Comparison.
Comparison utils and testers. All the following methods return booleans. nowWithSameTz
Depends on the following methods:
Properties
protectedbool | $endOfTime | ||
protectedbool | $startOfTime |
Methods
Determines if the instance is greater (after) than another
Determines if the instance is greater (after) than another
Determines if the instance is greater (after) than or equal to another
Determines if the instance is greater (after) than or equal to another
Determines if the instance is less (before) than another
Determines if the instance is less (before) than another
Determines if the instance is less (before) or equal to another
Determines if the instance is less (before) or equal to another
Determines if the instance is between two others.
Determines if the instance is between two others, bounds included.
Determines if the instance is between two others, bounds excluded.
Determines if the instance is between two others
Determines if the instance is a weekday.
Determines if the instance is a weekend day.
Determines if the instance is yesterday.
Determines if the instance is today.
Determines if the instance is tomorrow.
Determines if the instance is in the future, ie. greater (after) than now.
Determines if the instance is in the past, ie. less (before) than now.
Determines if the instance is a leap year.
Determines if the instance is a long year
Compares the formatted values of the two dates.
Determines if the instance is in the current unit given.
Determines if the instance is in the current unit given.
Checks if the passed in date is in the same quarter as the instance quarter (and year if needed).
Checks if the passed in date is in the same month as the instance´s month.
Checks if this day is a specific day of the week.
Check if its the birthday. Compares the date/month values of the two dates.
Check if today is the last day of the Month
Check if the instance is start of day / midnight.
Check if the instance is end of day.
Check if the instance is start of day / midnight.
Check if the instance is midday.
Checks if the (date)time string is in a given format.
Checks if the (date)time string is in a given format.
Checks if the (date)time string is in a given format and valid to create a new instance.
Returns true if the current date matches the given string.
Returns true if the date was created using CarbonImmutable::startOfTime()
Returns true if the date was created using CarbonImmutable::endOfTime()
No description
No description
No description
Details
at line57
bool
eq(Carbon|DateTimeInterface|mixed$date)
Determines if the instance is equal to another
at line76
bool
equalTo(Carbon|DateTimeInterface|mixed$date)
Determines if the instance is equal to another
at line100
bool
ne(Carbon|DateTimeInterface|mixed$date)
Determines if the instance is not equal to another
at line119
bool
notEqualTo(Carbon|DateTimeInterface|mixed$date)
Determines if the instance is not equal to another
at line140
bool
gt(Carbon|DateTimeInterface|mixed$date)
Determines if the instance is greater (after) than another
at line159
bool
greaterThan(Carbon|DateTimeInterface|mixed$date)
Determines if the instance is greater (after) than another
at line183
bool
isAfter(Carbon|DateTimeInterface|mixed$date)
Determines if the instance is greater (after) than another
at line204
bool
gte(Carbon|DateTimeInterface|mixed$date)
Determines if the instance is greater (after) than or equal to another
at line223
bool
greaterThanOrEqualTo(Carbon|DateTimeInterface|mixed$date)
Determines if the instance is greater (after) than or equal to another
at line247
bool
lt(Carbon|DateTimeInterface|mixed$date)
Determines if the instance is less (before) than another
at line266
bool
lessThan(Carbon|DateTimeInterface|mixed$date)
Determines if the instance is less (before) than another
at line290
bool
isBefore(Carbon|DateTimeInterface|mixed$date)
Determines if the instance is less (before) than another
at line311
bool
lte(Carbon|DateTimeInterface|mixed$date)
Determines if the instance is less (before) or equal to another
at line330
bool
lessThanOrEqualTo(Carbon|DateTimeInterface|mixed$date)
Determines if the instance is less (before) or equal to another
at line359
bool
between(Carbon|DateTimeInterface|mixed$date1,Carbon|DateTimeInterface|mixed$date2,bool$equal =true)
Determines if the instance is between two others.
The third argument allow you to specify if bounds are included or not (true by default) but for when you including/excluding bounds may produce different results in your application, we recommend to use the explicit methods ->betweenIncluded() or ->betweenExcluded() instead.
at line390
bool
betweenIncluded(Carbon|DateTimeInterface|mixed$date1,Carbon|DateTimeInterface|mixed$date2)
Determines if the instance is between two others, bounds included.
at line410
bool
betweenExcluded(Carbon|DateTimeInterface|mixed$date1,Carbon|DateTimeInterface|mixed$date2)
Determines if the instance is between two others, bounds excluded.
at line432
bool
isBetween(Carbon|DateTimeInterface|mixed$date1,Carbon|DateTimeInterface|mixed$date2,bool$equal =true)
Determines if the instance is between two others
at line448
bool
isWeekday()
Determines if the instance is a weekday.
at line464
bool
isWeekend()
Determines if the instance is a weekend day.
at line480
bool
isYesterday()
Determines if the instance is yesterday.
at line496
bool
isToday()
Determines if the instance is today.
at line512
bool
isTomorrow()
Determines if the instance is tomorrow.
at line528
bool
isFuture()
Determines if the instance is in the future, ie. greater (after) than now.
at line544
bool
isPast()
Determines if the instance is in the past, ie. less (before) than now.
at line560
bool
isLeapYear()
Determines if the instance is a leap year.
at line578
bool
isLongYear()
Determines if the instance is a long year
at line597
bool
isSameAs(string$format,Carbon|DateTimeInterface|string|null$date =null)
Compares the formatted values of the two dates.
at line618
bool
isSameUnit(string$unit,Carbon|DateTimeInterface|null$date =null)
Determines if the instance is in the current unit given.
at line669
bool
isCurrentUnit(string$unit)
Determines if the instance is in the current unit given.
at line690
bool
isSameQuarter(Carbon|DateTimeInterface|string|null$date =null,bool$ofSameYear =true)
Checks if the passed in date is in the same quarter as the instance quarter (and year if needed).
at line713
bool
isSameMonth(Carbon|DateTimeInterface|null$date =null,bool$ofSameYear =true)
Checks if the passed in date is in the same month as the instance´s month.
at line733
bool
isDayOfWeek(int$dayOfWeek)
Checks if this day is a specific day of the week.
at line757
bool
isBirthday(Carbon|DateTimeInterface|null$date =null)
Check if its the birthday. Compares the date/month values of the two dates.
at line776
bool
isLastOfMonth()
Check if today is the last day of the Month
at line797
bool
isStartOfDay(bool$checkMicroseconds =false)
Check if the instance is start of day / midnight.
at line823
bool
isEndOfDay(bool$checkMicroseconds =false)
Check if the instance is end of day.
at line843
bool
isMidnight()
Check if the instance is start of day / midnight.
at line861
bool
isMidday()
Check if the instance is midday.
at line881
staticbool
hasFormat(string$date,string$format)
Checks if the (date)time string is in a given format.
at line904
staticbool
hasFormatWithModifiers(string$date,string$format)
Checks if the (date)time string is in a given format.
at line924
staticbool
canBeCreatedFromFormat(string$date,string$format)
Checks if the (date)time string is in a given format and valid to create a new instance.
at line963
bool
is(string$tester)
Returns true if the current date matches the given string.
at line1071
bool
isStartOfTime()
Returns true if the date was created using CarbonImmutable::startOfTime()
at line1081
bool
isEndOfTime()
Returns true if the date was created using CarbonImmutable::endOfTime()