Date object
Properties
year- Returns the 4 digit year
month- Returns an
intfrom1-12, representing the month
- Returns an
day- Returns an
intfrom1-31
- Returns an
hour- Returns an
intfrom0-23
- Returns an
minute- Returns an
intfrom0-59
- Returns an
second- Returns an
intfrom0-59
- Returns an
timestamp- Returns a UNIX timestamp
weekStartsAt- Returns an
intfrom0-6(0- Sunday,6- Saturday)
- Returns an
weekEndsAt- Same as above
dateString- Returns a
Y-m-dstring
- Returns a
dateTimeString- Returns a
Y-m-d H:i:sstring
- Returns a
timeString- Returns a
H:i:sstring
- Returns a
weekday- Returns a
booleanresult if the date is a weekday date
- Returns a
weekend- Returns a
booleanresult if the date is a weekend date
- Returns a
sunday- Returns
trueif the date is a Sunday - Works for all week days
monday,tuesday,wednesday, etc
- Returns
Methods
format- Format the date to PHP's date formatting guidelines, e.g. -
event.startDate.format("l d, Y")
- Format the date to PHP's date formatting guidelines, e.g. -
eq- check if a date is equal to another date.
event.startDate.eq(event.endDate)would return true if both dates would be equal
ne- check if the dates are not equal
gt- checks if a date is greater than the other date
event.startDate.gt(anotherEvent.startDate)would return true only ifevent.startDatewere greater thananotherEvent.startDate
gte- check for greater OR equal than
lt- check for less than
lte- less than OR equal
between- check if a date is between two other dates
event.startDate.between(month.startDate, month.endDate)would return true if theevent.startDatewere between a given month range