Neuron-PHP

Date
in package

General date functions.

Table of Contents

Properties

$quarters  : array<string|int, mixed>

Methods

compare()  : int
dateToJulian()  : int
daysAsText()  : string
diff()  : int
differenceUnitAsText()  : string
Turns a time difference into a text format.
getCurrentMonthEndDate()  : string
getCurrentMonthStartDate()  : string
Returns the current month starting date.
getDateRangeForMonth()  : DateRange
Returns the date range for a year/month number.
getDateRangeForQuarter()  : DateRange
Returns the date range for the specified fiscal quarter.
getDateRangeForWeek()  : DateRange
Returns the date range for a specific year/week number.
getDay()  : false|string
Get the day name for a date.
getDaysInMonth()  : int
getWeekday()  : int
Returns an int representing the day of the week.
getWorkingDays()  : int
Get the number of working days in a date range.
isLeapYear()  : bool
Returns true if the date ia leap year.
isWeekend()  : bool
Is the date on a weekend?
julianToDate()  : string
only()  : false|string
If present, strips the time element from a date.
subtractDays()  : bool|string
today()  : false|string
Return today's date
tomorrow()  : false|string
Return tomorrow's date
yesterday()  : false|string
Return yesterday's date

Properties

$quarters

private static array<string|int, mixed> $quarters = [1 => ["01-01", "03-31"], 2 => ["04-01", "06-30"], 3 => ["07-01", "09-30"], 4 => ["10-01", "12-31"]]

Methods

compare()

public static compare(string $first, string $second) : int
Parameters
$first : string
$second : string
Return values
int

dateToJulian()

public static dateToJulian(mixed $date) : int
Parameters
$date : mixed
Return values
int

daysAsText()

public static daysAsText(mixed $days) : string
Parameters
$days : mixed
Return values
string

diff()

public static diff(mixed $endDate, mixed $beginDate) : int
Parameters
$endDate : mixed
$beginDate : mixed
Return values
int

differenceUnitAsText()

Turns a time difference into a text format.

public static differenceUnitAsText(mixed $time[, mixed $until = null ]) : string
Parameters
$time : mixed
$until : mixed = null
Return values
string

getCurrentMonthEndDate()

public static getCurrentMonthEndDate() : string
Return values
string

getCurrentMonthStartDate()

Returns the current month starting date.

public static getCurrentMonthStartDate() : string
Return values
string

A string in yyyy-mm-dd mysql format.

getDateRangeForMonth()

Returns the date range for a year/month number.

public static getDateRangeForMonth([int $month = 0 ][, string $year = '' ]) : DateRange
Parameters
$month : int = 0
$year : string = ''
Return values
DateRange

getDateRangeForQuarter()

Returns the date range for the specified fiscal quarter.

public static getDateRangeForQuarter([int $quarter = 0 ][, string $year = '' ]) : DateRange
Parameters
$quarter : int = 0
$year : string = ''
Return values
DateRange

getDateRangeForWeek()

Returns the date range for a specific year/week number.

public static getDateRangeForWeek([int $week = 0 ][, string $year = '' ]) : DateRange
Parameters
$week : int = 0
$year : string = ''
Return values
DateRange

getDay()

Get the day name for a date.

public static getDay(mixed $date) : false|string
Parameters
$date : mixed
Return values
false|string

getDaysInMonth()

public static getDaysInMonth(mixed $month[, null $year = null ]) : int
Parameters
$month : mixed
$year : null = null
Tags
SuppressWarnings

(PHPMD)

Returns the number of days in the specified month.

Return values
int

getWeekday()

Returns an int representing the day of the week.

public static getWeekday(string $date) : int

0 = Sunday .. 6 = Saturday

Parameters
$date : string
Return values
int

getWorkingDays()

Get the number of working days in a date range.

public static getWorkingDays(DateRange $range) : int
Parameters
$range : DateRange
Return values
int

isLeapYear()

Returns true if the date ia leap year.

public static isLeapYear(mixed $year) : bool
Parameters
$year : mixed
Return values
bool

isWeekend()

Is the date on a weekend?

public static isWeekend(mixed $date) : bool
Parameters
$date : mixed
Return values
bool

julianToDate()

public static julianToDate(mixed $julianDate) : string
Parameters
$julianDate : mixed
Return values
string

only()

If present, strips the time element from a date.

public static only(mixed $dateTime) : false|string
Parameters
$dateTime : mixed
Return values
false|string

subtractDays()

public static subtractDays(mixed $days[, string $date = '' ]) : bool|string
Parameters
$days : mixed
$date : string = ''
Return values
bool|string
  • new date

today()

Return today's date

public static today() : false|string
Return values
false|string

tomorrow()

Return tomorrow's date

public static tomorrow() : false|string
Return values
false|string

yesterday()

Return yesterday's date

public static yesterday() : false|string
Return values
false|string

        
On this page

Search results