Properties

$unix

$unix : integer

Type

integer — Unix timestamp representing the datetime of this object

Methods

now()

now() : static

Create a new DateTime object representing the current time.

Returns

static

parse()

parse(string|integer  $date, string|integer  $time = null) : \duncan3dc\Dates\Date

Parse dates in a variety of formats and create a Date object.

Parameters

string|integer $date

The date to parse

string|integer $time

The time to parse

Returns

\duncan3dc\Dates\Date

fromFormat()

fromFormat(string  $format, string  $date) : static

Create a new DateTime object from a specifically formatted date/time.

Parameters

string $format

The format that the date/time is in

string $date

The date/time to parse

Returns

static

mktime()

mktime(integer  $hour, integer  $minute, integer  $second, integer  $month, integer  $day, integer  $year) : static

Create a new DateTime object from a set of individual parts.

Parameters

integer $hour

The hour

integer $minute

The minute

integer $second

The second

integer $month

The month

integer $day

The day

integer $year

The year

Returns

static

__construct()

__construct(  $unix) 

Create a new instance from a unix timestamp.

Parameters

$unix

timestamp()

timestamp() : integer

Get the datetime as a unix timestamp.

Returns

integer

getMonth()

getMonth() : \duncan3dc\Dates\Month

Get a Month object for this date.

Returns

\duncan3dc\Dates\Month

getYear()

getYear() : \duncan3dc\Dates\Year

Get a Year object for this date.

Returns

\duncan3dc\Dates\Year

midday()

midday() : integer

Get a unix timestamp for 12pm on this date.

Returns

integer

start()

start() : integer

Get a unix timestamp for the start of this date.

Returns

integer

end()

end() : integer

Get a unix timestamp for the end of this date.

Returns

integer

withYear()

withYear(integer  $year) : static

Get a new instance but with the specified year.

Parameters

integer $year

The year to use

Returns

static

withMonth()

withMonth(integer  $month) : static

Get a new instance but with the specified month.

Parameters

integer $month

The month to use

Returns

static

withDay()

withDay(integer  $day) : static

Get a new instance but with the specified day.

Parameters

integer $day

The day to use

Returns

static

withHours()

withHours(integer  $hour) : \duncan3dc\Dates\DateTime

Get a new instance but with the specified hour.

Parameters

integer $hour

The hour to use

Returns

\duncan3dc\Dates\DateTime

withMinutes()

withMinutes(integer  $minute) : \duncan3dc\Dates\DateTime

Get a new instance but with the specified minute.

Parameters

integer $minute

The minute to use

Returns

\duncan3dc\Dates\DateTime

withSeconds()

withSeconds(integer  $second) : static

Get a new instance but with the specified second.

Parameters

integer $second

The second to use

Returns

static

isBankHoliday()

isBankHoliday() : boolean

Check if this object is a bank holiday.

Returns

boolean

isDay()

isDay(integer  $day) : boolean

Check if this date is the specified day.

Parameters

integer $day

The ISO-8601 number of the day

Returns

boolean

isMonday()

isMonday() : boolean

Check if this date is a monday.

Returns

boolean

isTuesday()

isTuesday() : boolean

Check if this date is a tuesday.

Returns

boolean

isWednesday()

isWednesday() : boolean

Check if this date is a wednesday.

Returns

boolean

isThursday()

isThursday() : boolean

Check if this date is a thursday.

Returns

boolean

isFriday()

isFriday() : boolean

Check if this date is a friday.

Returns

boolean

isSaturday()

isSaturday() : boolean

Check if this date is a saturday.

Returns

boolean

isSunday()

isSunday() : boolean

Check if this date is a sunday.

Returns

boolean

isWeekday()

isWeekday() : boolean

Check if this date is a weekday.

Returns

boolean

isWeekend()

isWeekend() : boolean

Check if this date is a weekend.

Returns

boolean

getPrevious()

getPrevious(integer  $day) : \duncan3dc\Dates\Traits\Date

Get a date object for the previous occurence of a specified day.

Parameters

integer $day

The numeric representation of the day.

Returns

\duncan3dc\Dates\Traits\Date

getNext()

getNext(integer  $day) : \duncan3dc\Dates\Traits\Date

Get a date object for the next occurence of a specified day.

Parameters

integer $day

The numeric representation of the day.

Returns

\duncan3dc\Dates\Traits\Date

numeric()

numeric(  $format) : integer

Format the date unsing the specified format and return a number.

Parameters

$format

Returns

integer

string()

string(  $format) : string

Format the date unsing the specified format and return a string.

Parameters

$format

Returns

string

format()

format(  $format) : string|integer

Format the date using the specified format.

This method will convert the result to an integer if it looks like one.

Parameters

$format

Returns

string|integer

addDays()

addDays(integer  $days) : static

Get a DateTime object for the specified number of days difference.

Parameters

integer $days

The number of days to add

Returns

static

subDays()

subDays(integer  $days) : static

Get a DateTime object for the specified number of days difference.

Parameters

integer $days

The number of days to subtract

Returns

static

prevDay()

prevDay() : static

Get a DateTime object for the previous day.

Returns

static

nextDay()

nextDay() : static

Get a DateTime object for the next day.

Returns

static

addWeeks()

addWeeks(integer  $weeks) : static

Get a DateTime object for the specified number of weeks difference.

Parameters

integer $weeks

The number of weeks to add

Returns

static

subWeeks()

subWeeks(integer  $weeks) : static

Get a DateTime object for the specified number of weeks difference.

Parameters

integer $weeks

The number of weeks to subtract

Returns

static

addMonths()

addMonths(integer  $months) : static

Get a DateTime object for the specified number of months difference.

Parameters

integer $months

The number of months to add

Returns

static

subMonths()

subMonths(integer  $months) : static

Get a DateTime object for the specified number of months difference.

Parameters

integer $months

The number of months to subtract

Returns

static

prevMonth()

prevMonth() : static

Get a DateTime object for the previous month.

Returns

static

nextMonth()

nextMonth() : static

Get a DateTime object for the next month.

Returns

static

addYears()

addYears(integer  $years) : static

Get a DateTime object for the specified number of years difference.

Parameters

integer $years

The number of years to add

Returns

static

subYears()

subYears(integer  $years) : static

Get a DateTime object for the specified number of years difference.

Parameters

integer $years

The number of years to subtract

Returns

static

prevYear()

prevYear() : static

Get a DateTime object for the previous year.

Returns

static

nextYear()

nextYear() : static

Get a DateTime object for the next year.

Returns

static

addSeconds()

addSeconds(integer  $seconds) : static

Get a DateTime object for the specified number of seconds difference.

Parameters

integer $seconds

The number of seconds to add

Returns

static

subSeconds()

subSeconds(integer  $seconds) : static

Get a DateTime object for the specified number of seconds difference.

Parameters

integer $seconds

The number of seconds to subtract

Returns

static

addMinutes()

addMinutes(integer  $minutes) : static

Get a DateTime object for the specified number of minutes difference.

Parameters

integer $minutes

The number of minutes to add

Returns

static

subMinutes()

subMinutes(integer  $minutes) : static

Get a DateTime object for the specified number of minutes difference.

Parameters

integer $minutes

The number of minutes to subtract

Returns

static

addHours()

addHours(integer  $hours) : static

Get a DateTime object for the specified number of hours difference.

Parameters

integer $hours

The number of hours to add

Returns

static

subHours()

subHours(integer  $hours) : static

Get a DateTime object for the specified number of hours difference.

Parameters

integer $hours

The number of hours to subtract

Returns

static

mkdate()

mkdate(integer  $year, integer  $month, integer  $day) : static

Create a new DateTime object from a set of individual parts.

Parameters

integer $year

The year

integer $month

The month

integer $day

The day

Returns

static

bhNewYearsDay()

bhNewYearsDay() 

bhEasterDays()

bhEasterDays() 

bhMayDays()

bhMayDays() 

bhEndOfAugust()

bhEndOfAugust() 

bhChristmasDays()

bhChristmasDays()