Date object
Properties
year
- Returns the 4 digit year
month
- Returns an
int
from1-12
, representing the month
- Returns an
day
- Returns an
int
from1-31
- Returns an
hour
- Returns an
int
from0-23
- Returns an
minute
- Returns an
int
from0-59
- Returns an
second
- Returns an
int
from0-59
- Returns an
timestamp
- Returns a UNIX timestamp
weekStartsAt
- Returns an
int
from0-6
(0
- Sunday,6
- Saturday)
- Returns an
weekEndsAt
- Same as above
dateString
- Returns a
Y-m-d
string
- Returns a
dateTimeString
- Returns a
Y-m-d H:i:s
string
- Returns a
timeString
- Returns a
H:i:s
string
- Returns a
weekday
- Returns a
boolean
result if the date is a weekday date
- Returns a
weekend
- Returns a
boolean
result if the date is a weekend date
- Returns a
sunday
- Returns
true
if 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.startDate
were 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.startDate
were between a given month range