TimeTrex API Manual

APITTDate extends TTDate
in package

Table of Contents

$day_of_week_arr  : mixed
$long_month_of_year_arr  : mixed
$short_month_of_year_arr  : mixed
$date_format  : mixed
$main_class  : mixed
$month_arr  : mixed
$time_format  : mixed
$time_unit_format  : mixed
$time_zone  : mixed
__construct()  : mixed
TTDate constructor.
calculateTimeOnEachDayBetweenRange()  : array<string|int, mixed>
convertSecondsToHMS()  : string
convertTimeZone()  : mixed
detectSystemTimeZone()  : string
Attempts to detect the full time zone in use by the system on both Windows and Linux.
doesRangeSpanDST()  : bool
doesRangeSpanMidnight()  : bool
getAnnualWeekDays()  : int
getAPIDate()  : bool|false|null|string
getBeginDayEpoch()  : false|int
getBeginMinuteEpoch()  : false|int
getBeginMonthEpoch()  : false|int
getBeginQuarterEpoch()  : mixed
getBeginWeekEpoch()  : false|int
getBeginYearEpoch()  : false|int
getBirthDateAtAge()  : false|int
getCalendarArray()  : array<string|int, mixed>|bool
Loop from filter start date to end date. Creating an array entry for each day.
getDate()  : bool|false|null|string
getDateArray()  : array<string|int, mixed>
Returns an array of dates within the range.
getDateByMonthOffset()  : false|int
getDateDifference()  : bool|float|int
getDateOfNextDayOfMonth()  : bool|false|int
getDateOfNextDayOfWeek()  : bool|false|int
getDateOfNextQuarter()  : false|int|mixed
getDateOfNextYear()  : bool|false|int
getDatePeriod()  : bool|Generator
Generator to loop over any date/time interval and properly handles spanning DST switch-overs.
getDateTimeObject()  : DateTime
Takes an integer epoch and converts it to a PHP DateTime object.
getDayDifference()  : bool|float|int
getDayOfMonth()  : false|string
getDayOfMonthArray()  : array<string|int, mixed>
getDayOfWeek()  : false|string
getDayOfWeekArray()  : array<string|int, mixed>|null
getDayOfWeekArrayByStartWeekDay()  : array<string|int, mixed>
getDayOfWeekByInt()  : bool
getDayOfWeekName()  : bool
getDayOfYear()  : false|string
getDays()  : string
getDaysInMonth()  : false|string
getDaysInYear()  : false|string
getDayWithMostTime()  : mixed
getDBTimeStamp()  : false|string
getDSTOffset()  : int
getEasterDays()  : float
getEndDayEpoch()  : false|int
getEndMonthEpoch()  : false|int
getEndQuarterEpoch()  : mixed
getEndWeekEpoch()  : false|int
getEndYearEpoch()  : false|int
getFiscalYearFromEpoch()  : false|string
getHour()  : false|string
getHours()  : string
getHumanReadableDateStamp()  : false|string
getHumanTimeSince()  : string
Function to return "13 mins ago" text from a given time.
getISO8601Duration()  : string
getISODateStamp()  : false|string
getISOTime()  : string
getISOTimeStamp()  : false|string
getISOTimeStampWithMilliseconds()  : false|string
getLastHireDateAnniversary()  : false|int
getMiddleDayEpoch()  : false|int
getMinute()  : false|string
getMonth()  : false|string
getMonthDifference()  : bool|float|int
getMonthName()  : bool|mixed
getMonthOfYearArray()  : array<string|int, mixed>|null
getNearestWeekDay()  : int
getNextDateFromArray()  : mixed
returns next date from array that is after the floor date
getReportDateOptions()  : array<string|int, mixed>
getReportDates()  : array<string|int, mixed>|bool|false|null|string
getSecond()  : false|string
getSeconds()  : string
getTime()  : int
getTimeLockedDate()  : false|int
getTimeNotOverLapDifference()  : bool|mixed
Gets the time between two shifts.
getTimeOverLap()  : array<string|int, mixed>|bool
getTimeOverLapDifference()  : bool|mixed
Gets the time two shifts overlap of one another.
getTimePeriodDates()  : array<string|int, mixed>|bool
getTimePeriodOptions()  : array<string|int, mixed>
getTimeStamp()  : int|mixed
getTimeStampFromSmarty()  : int|mixed
getTimeUnit()  : bool|int|string
getTimeZone()  : string
getTimeZoneOffset()  : false|string
getWeek()  : int
This could also be called: getWeekOfYear
getWeekDifference()  : bool|float|int
getWeeks()  : string
getYear()  : false|string
getYearDifference()  : bool|float|int
getYearQuarter()  : float
getYearQuarterMonth()  : bool|mixed
Returns the month of the quarter that the date falls in.
getYearQuarterMonthNumber()  : bool|mixed
Regardless of the quarter, this returns if its the 1st, 2nd or 3rd month in the quarter.
getYearQuarters()  : array<string|int, mixed>|bool|mixed
getYears()  : string
graceTime()  : mixed
inApplyFrequencyWindow()  : bool
incrementDate()  : false|int
inWindow()  : bool
isBindTimeStamp()  : bool
isConsecutiveDays()  : bool
isDST()  : bool
isMidnight()  : bool
isTimeOverLap()  : bool
Has TimeTres specific quirks. Use isTimeOverLapStandard() instead whenever possible.
isTimeOverLapStandard()  : bool
Find out if Date1 overlaps with Date2 using standard time overlap comparisons.
isValidDate()  : bool|false|int|null
Check to ensure that the date is within a validate integer range.
isWeekDay()  : bool
parseDateTime()  : bool|false|int|null
parseTimeUnit()  : bool|float|int|number|string
roundTime()  : int
setDateFormat()  : bool
setTimeFormat()  : bool
setTimeUnitFormat()  : bool
setTimeZone()  : bool
snapTime()  : mixed
splitDateRangeAtMidnight()  : array<string|int, mixed>
Break up a timespan into array of days between times and on midnight If no filter is specified, break days on midnight by default.
splitTimesByStartAndEndTime()  : array<string|int, mixed>
Takes an array of date ranges and splits them by split start and end ranges.
strtotime()  : int
Runs strtotime over a string, but if it happens to be an epoch, strtotime returns -1, so in this case, just return the epoch again.
_get_month_long_names()  : array<string|int, mixed>
_get_month_short_names()  : array<string|int, mixed>
incrementDateGetOtherMonth()  : false|mixed|string
Helper function for incrementDate() to make sure 31-Mar-2021 and minus 1 month from it gets 28-Feb-2021 rather than 01-Mar-2021 or something.

Properties

$day_of_week_arr

public static mixed $day_of_week_arr = \null

$long_month_of_year_arr

public static mixed $long_month_of_year_arr = \null

$short_month_of_year_arr

public static mixed $short_month_of_year_arr = \null

$date_format

protected static mixed $date_format = 'd-M-y'

$month_arr

protected static mixed $month_arr = ['jan' => 1, 'january' => 1, 'feb' => 2, 'february' => 2, 'mar' => 3, 'march' => 3, 'apr' => 4, 'april' => 4, 'may' => 5, 'jun' => 6, 'june' => 6, 'jul' => 7, 'july' => 7, 'aug' => 8, 'august' => 8, 'sep' => 9, 'september' => 9, 'oct' => 10, 'october' => 10, 'nov' => 11, 'november' => 11, 'dec' => 12, 'december' => 12]

$time_format

protected static mixed $time_format = 'g:i A T'

$time_unit_format

protected static mixed $time_unit_format = 20

Methods

__construct()

TTDate constructor.

public __construct() : mixed
Return values
mixed

calculateTimeOnEachDayBetweenRange()

public static calculateTimeOnEachDayBetweenRange(int $start_epoch, int $end_epoch) : array<string|int, mixed>
Parameters
$start_epoch : int

EPOCH

$end_epoch : int

EPOCH

Return values
array<string|int, mixed>

convertSecondsToHMS()

public static convertSecondsToHMS( $seconds[, bool $include_seconds = false ]) : string
Parameters
$seconds :
$include_seconds : bool = false
Return values
string

convertTimeZone()

public static convertTimeZone(int $epoch,  $timezone) : mixed
Parameters
$epoch : int

EPOCH

$timezone :
Return values
mixed

detectSystemTimeZone()

Attempts to detect the full time zone in use by the system on both Windows and Linux.

public static detectSystemTimeZone() : string
Return values
string

doesRangeSpanDST()

public static doesRangeSpanDST(int $start_epoch, int $end_epoch) : bool
Parameters
$start_epoch : int

EPOCH

$end_epoch : int

EPOCH

Return values
bool

doesRangeSpanMidnight()

public static doesRangeSpanMidnight(int $start_epoch, int $end_epoch[, bool $match_midnight = false ]) : bool
Parameters
$start_epoch : int

EPOCH

$end_epoch : int

EPOCH

$match_midnight : bool = false
Return values
bool

getAnnualWeekDays()

public static getAnnualWeekDays([int $epoch = null ]) : int
Parameters
$epoch : int = null

EPOCH

Return values
int

getAPIDate()

public static getAPIDate([string $format = 'DATE+TIME' ][, int $epoch = null ]) : bool|false|null|string
Parameters
$format : string = 'DATE+TIME'
$epoch : int = null

EPOCH

Return values
bool|false|null|string

getBeginDayEpoch()

public static getBeginDayEpoch([int $epoch = null ]) : false|int
Parameters
$epoch : int = null

EPOCH

Return values
false|int

getBeginMinuteEpoch()

public static getBeginMinuteEpoch([int $epoch = null ]) : false|int
Parameters
$epoch : int = null

EPOCH

Return values
false|int

getBeginMonthEpoch()

public static getBeginMonthEpoch([int $epoch = null ]) : false|int
Parameters
$epoch : int = null

EPOCH

Return values
false|int

getBeginQuarterEpoch()

public static getBeginQuarterEpoch([int $epoch = null ]) : mixed
Parameters
$epoch : int = null

EPOCH

Return values
mixed

getBeginWeekEpoch()

public static getBeginWeekEpoch([int $epoch = null ], int $start_day_of_week) : false|int
Parameters
$epoch : int = null

EPOCH

$start_day_of_week : int
Return values
false|int

getBeginYearEpoch()

public static getBeginYearEpoch([int $epoch = null ]) : false|int
Parameters
$epoch : int = null

EPOCH

Return values
false|int

getBirthDateAtAge()

public static getBirthDateAtAge(int $birth_date,  $age) : false|int
Parameters
$birth_date : int

EPOCH

$age :
Return values
false|int

getCalendarArray()

Loop from filter start date to end date. Creating an array entry for each day.

public static getCalendarArray(int $start_date, int $end_date, int $start_day_of_week[, bool $force_weeks = true ]) : array<string|int, mixed>|bool
Parameters
$start_date : int

EPOCH

$end_date : int

EPOCH

$start_day_of_week : int
$force_weeks : bool = true
Return values
array<string|int, mixed>|bool

getDate()

public static getDate([null $format = null ][, int $epoch = null ]) : bool|false|null|string
Parameters
$format : null = null
$epoch : int = null

EPOCH

Return values
bool|false|null|string

getDateArray()

Returns an array of dates within the range.

public static getDateArray(int $start_date, int $end_date[, bool $day_of_week = false ]) : array<string|int, mixed>
Parameters
$start_date : int

EPOCH

$end_date : int

EPOCH

$day_of_week : bool = false
Return values
array<string|int, mixed>

getDateByMonthOffset()

public static getDateByMonthOffset(int $epoch,  $month_offset) : false|int
Parameters
$epoch : int

EPOCH

$month_offset :
Return values
false|int

getDateDifference()

public static getDateDifference(int $start_epoch, int $end_epoch[, string $format = '%a' ]) : bool|float|int
Parameters
$start_epoch : int

EPOCH

$end_epoch : int

EPOCH

$format : string = '%a'
Return values
bool|float|int

getDateOfNextDayOfMonth()

public static getDateOfNextDayOfMonth(int $anchor_epoch, int $day_of_month_epoch[, int $day_of_month = null ]) : bool|false|int
Parameters
$anchor_epoch : int

EPOCH The anchor date to start searching from.

$day_of_month_epoch : int

EPOCH What we use to extract the day of the month from.

$day_of_month : int = null

Day of the month to use, ie: 1-31

Return values
bool|false|int

getDateOfNextDayOfWeek()

public static getDateOfNextDayOfWeek(int $anchor_epoch, int $day_of_week_epoch) : bool|false|int
Parameters
$anchor_epoch : int

EPOCH

$day_of_week_epoch : int

EPOCH

Return values
bool|false|int

getDateOfNextQuarter()

public static getDateOfNextQuarter( $anchor_epoch[, int $day_of_month = 1 ][, int $month_of_quarter = 1 ]) : false|int|mixed
Parameters
$anchor_epoch :
$day_of_month : int = 1
$month_of_quarter : int = 1
Return values
false|int|mixed

getDateOfNextYear()

public static getDateOfNextYear(int $anchor_epoch, int $year_epoch) : bool|false|int
Parameters
$anchor_epoch : int

EPOCH

$year_epoch : int

EPOCH

Return values
bool|false|int

getDatePeriod()

Generator to loop over any date/time interval and properly handles spanning DST switch-overs.

public static getDatePeriod(int|DateTime $start, int|DateTime $end[, string|DateInterval $interval = 'P1D' ][, bool $include_end_date = true ]) : bool|Generator
Parameters
$start : int|DateTime

Epoch or DateTime object

$end : int|DateTime

Epoch or DateTime object

$interval : string|DateInterval = 'P1D'

string interval or DateInterval object

$include_end_date : bool = true
Tags
throws
Exception
Return values
bool|Generator

getDateTimeObject()

Takes an integer epoch and converts it to a PHP DateTime object.

public static getDateTimeObject( $epoch) : DateTime
Parameters
$epoch :
Tags
throws
Exception
Return values
DateTime

getDayDifference()

public static getDayDifference(int $start_epoch, int $end_epoch[, bool $round = true ]) : bool|float|int
Parameters
$start_epoch : int

EPOCH

$end_epoch : int

EPOCH

$round : bool = true
Return values
bool|float|int

getDayOfMonth()

public static getDayOfMonth([int $epoch = null ]) : false|string
Parameters
$epoch : int = null

EPOCH

Return values
false|string

getDayOfMonthArray()

public static getDayOfMonthArray([mixed $include_last_day_of_month = false ]) : array<string|int, mixed>
Parameters
$include_last_day_of_month : mixed = false
Return values
array<string|int, mixed>

getDayOfWeek()

public static getDayOfWeek(int $epoch, int $start_week_day) : false|string
Parameters
$epoch : int

EPOCH

$start_week_day : int
Return values
false|string

getDayOfWeekArray()

public static getDayOfWeekArray([bool $translation = true ]) : array<string|int, mixed>|null
Parameters
$translation : bool = true
Return values
array<string|int, mixed>|null

getDayOfWeekArrayByStartWeekDay()

public static getDayOfWeekArrayByStartWeekDay(int $start_week_day) : array<string|int, mixed>
Parameters
$start_week_day : int
Return values
array<string|int, mixed>

getDayOfWeekByInt()

public static getDayOfWeekByInt( $int[, bool $translation = true ]) : bool
Parameters
$int :
$translation : bool = true
Return values
bool

getDayOfWeekName()

public static getDayOfWeekName( $dow) : bool
Parameters
$dow :
Return values
bool

getDayOfYear()

public static getDayOfYear(int $epoch) : false|string
Parameters
$epoch : int

EPOCH

Return values
false|string

getDays()

public static getDays( $seconds) : string
Parameters
$seconds :
Return values
string

getDaysInMonth()

public static getDaysInMonth([int $epoch = null ]) : false|string
Parameters
$epoch : int = null

EPOCH

Return values
false|string

getDaysInYear()

public static getDaysInYear([int $epoch = null ]) : false|string
Parameters
$epoch : int = null

EPOCH

Return values
false|string

getDayWithMostTime()

public static getDayWithMostTime(int $start_epoch, int $end_epoch) : mixed
Parameters
$start_epoch : int

EPOCH

$end_epoch : int

EPOCH

Return values
mixed

getDBTimeStamp()

public static getDBTimeStamp(int $epoch[, bool $include_time_zone = true ]) : false|string
Parameters
$epoch : int

EPOCH

$include_time_zone : bool = true
Return values
false|string

getDSTOffset()

public static getDSTOffset(int $start_epoch, int $end_epoch) : int
Parameters
$start_epoch : int

EPOCH

$end_epoch : int

EPOCH

Return values
int

getEasterDays()

public static getEasterDays( $year) : float
Parameters
$year :
Return values
float

getEndDayEpoch()

public static getEndDayEpoch([int $epoch = null ]) : false|int
Parameters
$epoch : int = null

EPOCH

Return values
false|int

getEndMonthEpoch()

public static getEndMonthEpoch([int $epoch = null ]) : false|int
Parameters
$epoch : int = null

EPOCH

Return values
false|int

getEndQuarterEpoch()

public static getEndQuarterEpoch([int $epoch = null ]) : mixed
Parameters
$epoch : int = null

EPOCH

Return values
mixed

getEndWeekEpoch()

public static getEndWeekEpoch([int $epoch = null ], int $start_day_of_week) : false|int
Parameters
$epoch : int = null

EPOCH

$start_day_of_week : int
Return values
false|int

getEndYearEpoch()

public static getEndYearEpoch([int $epoch = null ]) : false|int
Parameters
$epoch : int = null

EPOCH

Return values
false|int

getFiscalYearFromEpoch()

public static getFiscalYearFromEpoch(int $epoch[, int $offset = 3 ]) : false|string
Parameters
$epoch : int

EPOCH

$offset : int = 3
Return values
false|string

getHour()

public static getHour([int $epoch = null ]) : false|string
Parameters
$epoch : int = null

EPOCH

Return values
false|string

getHours()

public static getHours( $seconds) : string
Parameters
$seconds :
Return values
string

getHumanReadableDateStamp()

public static getHumanReadableDateStamp(int $epoch) : false|string
Parameters
$epoch : int

EPOCH

Return values
false|string

getHumanTimeSince()

Function to return "13 mins ago" text from a given time.

public static getHumanTimeSince(int $epoch[, null $current_time = null ]) : string
Parameters
$epoch : int

EPOCH

$current_time : null = null
Return values
string

getISO8601Duration()

public static getISO8601Duration( $time) : string
Parameters
$time :
Return values
string

getISODateStamp()

public static getISODateStamp(int $epoch) : false|string
Parameters
$epoch : int

EPOCH

Return values
false|string

getISOTime()

public static getISOTime(int $epoch) : string
Parameters
$epoch : int
Return values
string

getISOTimeStamp()

public static getISOTimeStamp(int $epoch) : false|string
Parameters
$epoch : int

EPOCH

Return values
false|string

getISOTimeStampWithMilliseconds()

public static getISOTimeStampWithMilliseconds(float $epoch) : false|string
Parameters
$epoch : float

EPOCH

Return values
false|string

getLastHireDateAnniversary()

public static getLastHireDateAnniversary(int $hire_date) : false|int
Parameters
$hire_date : int

EPOCH

Return values
false|int

getMiddleDayEpoch()

public static getMiddleDayEpoch([int $epoch = null ]) : false|int
Parameters
$epoch : int = null

EPOCH

Return values
false|int

getMinute()

public static getMinute([int $epoch = null ]) : false|string
Parameters
$epoch : int = null

EPOCH

Return values
false|string

getMonth()

public static getMonth([int $epoch = null ]) : false|string
Parameters
$epoch : int = null

EPOCH

Return values
false|string

getMonthDifference()

public static getMonthDifference(int $start_epoch, int $end_epoch) : bool|float|int
Parameters
$start_epoch : int

EPOCH

$end_epoch : int

EPOCH

Return values
bool|float|int

getMonthName()

public static getMonthName( $month[, bool $short_name = false ]) : bool|mixed
Parameters
$month :
$short_name : bool = false
Return values
bool|mixed

getMonthOfYearArray()

public static getMonthOfYearArray([bool $short_name = false ]) : array<string|int, mixed>|null
Parameters
$short_name : bool = false
Return values
array<string|int, mixed>|null

getNearestWeekDay()

public static getNearestWeekDay(int $epoch, int $type[, array<string|int, mixed> $exclude_epochs = [] ]) : int
Parameters
$epoch : int

EPOCH

$type : int
$exclude_epochs : array<string|int, mixed> = []
Return values
int

getNextDateFromArray()

returns next date from array that is after the floor date

public static getNextDateFromArray(int $floor, array<string|int, mixed> $dates) : mixed
Parameters
$floor : int
$dates : array<string|int, mixed>
Return values
mixed

getReportDateOptions()

public static getReportDateOptions([null $column_name_prefix = null ][, null $column_name = null ][, null $sort_prefix = null ][, bool $include_pay_period = true ]) : array<string|int, mixed>
Parameters
$column_name_prefix : null = null
$column_name : null = null
$sort_prefix : null = null
$include_pay_period : bool = true
Return values
array<string|int, mixed>

getReportDates()

public static getReportDates( $column[, int $epoch = null ][, bool $post_processing = true ][, object $user_obj = null ][, null $params = null ][, null $display_columns = null ]) : array<string|int, mixed>|bool|false|null|string
Parameters
$column :
$epoch : int = null

EPOCH

$post_processing : bool = true
$user_obj : object = null
$params : null = null
$display_columns : null = null
Return values
array<string|int, mixed>|bool|false|null|string

getSecond()

public static getSecond([int $epoch = null ]) : false|string
Parameters
$epoch : int = null

EPOCH

Return values
false|string

getSeconds()

public static getSeconds( $hours) : string
Parameters
$hours :
Return values
string

getTime()

public static getTime() : int
Return values
int

getTimeLockedDate()

public static getTimeLockedDate(int $time_epoch, int $date_epoch) : false|int
Parameters
$time_epoch : int

EPOCH

$date_epoch : int

EPOCH

Return values
false|int

getTimeNotOverLapDifference()

Gets the time between two shifts.

public static getTimeNotOverLapDifference(int $start_date1, int $end_date1, int $start_date2, int $end_date2) : bool|mixed
Parameters
$start_date1 : int

EPOCH

$end_date1 : int

EPOCH

$start_date2 : int

EPOCH

$end_date2 : int

EPOCH

Return values
bool|mixed

getTimeOverLap()

public static getTimeOverLap(int $start_date1, int $end_date1, int $start_date2, int $end_date2) : array<string|int, mixed>|bool
Parameters
$start_date1 : int

EPOCH

$end_date1 : int

EPOCH

$start_date2 : int

EPOCH

$end_date2 : int

EPOCH

Return values
array<string|int, mixed>|bool

getTimeOverLapDifference()

Gets the time two shifts overlap of one another.

public static getTimeOverLapDifference(int $start_date1, int $end_date1, int $start_date2, int $end_date2) : bool|mixed
Parameters
$start_date1 : int

EPOCH

$end_date1 : int

EPOCH

$start_date2 : int

EPOCH

$end_date2 : int

EPOCH

Return values
bool|mixed

getTimePeriodDates()

public static getTimePeriodDates( $time_period[, int $epoch = null ][, object $user_obj = null ][, null $params = null ]) : array<string|int, mixed>|bool
Parameters
$time_period :
$epoch : int = null

EPOCH

$user_obj : object = null
$params : null = null
Return values
array<string|int, mixed>|bool

getTimePeriodOptions()

public static getTimePeriodOptions([bool $include_pay_period = true ]) : array<string|int, mixed>
Parameters
$include_pay_period : bool = true
Return values
array<string|int, mixed>

getTimeStamp()

public static getTimeStamp([string $year = "" ][, string $month = "" ][, string $day = "" ], int $hour, int $min, int $sec) : int|mixed
Parameters
$year : string = ""
$month : string = ""
$day : string = ""
$hour : int
$min : int
$sec : int
Tags
noinspection

PhpUndefinedFunctionInspection

Return values
int|mixed

getTimeStampFromSmarty()

public static getTimeStampFromSmarty( $prefix,  $array) : int|mixed
Parameters
$prefix :
$array :
Return values
int|mixed

getTimeUnit()

public static getTimeUnit( $seconds[, null $time_unit_format = null ]) : bool|int|string
Parameters
$seconds :
$time_unit_format : null = null
Return values
bool|int|string

getTimeZone()

public static getTimeZone() : string
Return values
string

getTimeZoneOffset()

public static getTimeZoneOffset([mixed $epoch = null ]) : false|string
Parameters
$epoch : mixed = null
Return values
false|string

getWeek()

This could also be called: getWeekOfYear

public static getWeek([int $epoch = null ], int $start_week_day) : int
Parameters
$epoch : int = null

EPOCH

$start_week_day : int
Return values
int

getWeekDifference()

public static getWeekDifference(int $start_epoch, int $end_epoch) : bool|float|int
Parameters
$start_epoch : int

EPOCH

$end_epoch : int

EPOCH

Return values
bool|float|int

getWeeks()

public static getWeeks( $seconds) : string
Parameters
$seconds :
Return values
string

getYear()

public static getYear([int $epoch = null ]) : false|string
Parameters
$epoch : int = null

EPOCH

Return values
false|string

getYearDifference()

public static getYearDifference(int $start_epoch, int $end_epoch) : bool|float|int
Parameters
$start_epoch : int

EPOCH

$end_epoch : int

EPOCH

Return values
bool|float|int

getYearQuarter()

public static getYearQuarter([int $epoch = null ]) : float
Parameters
$epoch : int = null

EPOCH

Return values
float

getYearQuarterMonth()

Returns the month of the quarter that the date falls in.

public static getYearQuarterMonth([int $epoch = null ]) : bool|mixed

Used for government forms that require a break down for each month in the quarter.

Parameters
$epoch : int = null

EPOCH

Return values
bool|mixed

getYearQuarterMonthNumber()

Regardless of the quarter, this returns if its the 1st, 2nd or 3rd month in the quarter.

public static getYearQuarterMonthNumber([int $epoch = null ]) : bool|mixed

Primary used for government forms.

Parameters
$epoch : int = null

EPOCH

Return values
bool|mixed

getYearQuarters()

public static getYearQuarters([int $epoch = null ][, null $quarter = null ][, int $day_of_month = 1 ]) : array<string|int, mixed>|bool|mixed
Parameters
$epoch : int = null

EPOCH

$quarter : null = null
$day_of_month : int = 1
Return values
array<string|int, mixed>|bool|mixed

getYears()

public static getYears( $seconds) : string
Parameters
$seconds :
Return values
string

graceTime()

public static graceTime(int $current_epoch,  $grace_time, int $schedule_epoch) : mixed
Parameters
$current_epoch : int

EPOCH

$grace_time :
$schedule_epoch : int

EPOCH

Return values
mixed

inApplyFrequencyWindow()

public static inApplyFrequencyWindow(int $frequency_id, int $start_date, int $end_date[, array<string|int, mixed> $frequency_criteria = [] ]) : bool
Parameters
$frequency_id : int
$start_date : int

EPOCH

$end_date : int

EPOCH

$frequency_criteria : array<string|int, mixed> = []
Return values
bool

incrementDate()

public static incrementDate(int $epoch,  $amount,  $unit) : false|int
Parameters
$epoch : int

EPOCH

$amount :
$unit :
Return values
false|int

inWindow()

public static inWindow(int $epoch, int $window_epoch,  $window) : bool
Parameters
$epoch : int

EPOCH

$window_epoch : int

EPOCH

$window :
Return values
bool

isBindTimeStamp()

public static isBindTimeStamp( $str) : bool
Parameters
$str :
Return values
bool

isConsecutiveDays()

public static isConsecutiveDays(int|array<string|int, int> $date_array) : bool
Parameters
$date_array : int|array<string|int, int>

EPOCH

Return values
bool

isDST()

public static isDST([int $epoch = null ]) : bool
Parameters
$epoch : int = null

EPOCH

Return values
bool

isMidnight()

public static isMidnight(int $epoch) : bool
Parameters
$epoch : int

EPOCH

Return values
bool

isTimeOverLap()

Has TimeTres specific quirks. Use isTimeOverLapStandard() instead whenever possible.

public static isTimeOverLap(int $start_date1, int $end_date1, int $start_date2, int $end_date2) : bool
Parameters
$start_date1 : int

EPOCH

$end_date1 : int

EPOCH

$start_date2 : int

EPOCH

$end_date2 : int

EPOCH

Return values
bool

isTimeOverLapStandard()

Find out if Date1 overlaps with Date2 using standard time overlap comparisons.

public static isTimeOverLapStandard(int $start_date1, int $end_date1, int $start_date2, int $end_date2[, mixed $include_exact = false ]) : bool
Parameters
$start_date1 : int

EPOCH

$end_date1 : int

EPOCH

$start_date2 : int

EPOCH

$end_date2 : int

EPOCH

$include_exact : mixed = false
Return values
bool

isValidDate()

Check to ensure that the date is within a validate integer range.

public static isValidDate( $value) : bool|false|int|null
Parameters
$value :
Return values
bool|false|int|null

isWeekDay()

public static isWeekDay([int $epoch = null ]) : bool
Parameters
$epoch : int = null

EPOCH

Return values
bool

parseDateTime()

public static parseDateTime( $str) : bool|false|int|null
Parameters
$str :
Return values
bool|false|int|null

parseTimeUnit()

public static parseTimeUnit( $time_unit[, null $format = null ]) : bool|float|int|number|string
Parameters
$time_unit :
$format : null = null
Return values
bool|float|int|number|string

roundTime()

public static roundTime(int $epoch,  $round_value[, int $round_type = 20 ], int $grace_time) : int
Parameters
$epoch : int

EPOCH

$round_value :
$round_type : int = 20

10=Down, 20=Average, 25=Average (split seconds up), 27=Average (split seconds down) 30=Up

$grace_time : int
Return values
int

setDateFormat()

public static setDateFormat(int $date_format) : bool
Parameters
$date_format : int

EPOCH

Return values
bool

setTimeFormat()

public static setTimeFormat( $time_format) : bool
Parameters
$time_format :
Return values
bool

setTimeUnitFormat()

public static setTimeUnitFormat( $time_unit_format) : bool
Parameters
$time_unit_format :
Return values
bool

setTimeZone()

public static setTimeZone([null $time_zone = null ][, bool $force = false ][, bool $execute_sql_now = true ]) : bool
Parameters
$time_zone : null = null
$force : bool = false
$execute_sql_now : bool = true
Return values
bool

snapTime()

public static snapTime(int $epoch, int $snap_to_epoch,  $snap_type) : mixed
Parameters
$epoch : int

EPOCH

$snap_to_epoch : int

EPOCH

$snap_type :
Return values
mixed

splitDateRangeAtMidnight()

Break up a timespan into array of days between times and on midnight If no filter is specified, break days on midnight by default.

public static splitDateRangeAtMidnight(time|int $start_time_stamp, time|int $end_time_stamp[, time|bool $filter_start_time_stamp = false ][, time|bool $filter_end_time_stamp = false ]) : array<string|int, mixed>
Parameters
$start_time_stamp : time|int
$end_time_stamp : time|int
$filter_start_time_stamp : time|bool = false
$filter_end_time_stamp : time|bool = false
Return values
array<string|int, mixed>

splitTimesByStartAndEndTime()

Takes an array of date ranges and splits them by split start and end ranges.

public static splitTimesByStartAndEndTime( $ranges_to_split,  $split_start_time,  $split_end_time[,  $new_properties = [] ]) : array<string|int, mixed>

Returned ranges are marked as modified, modified_new, new, replaced, no_overlap and no_split (no changes).

Parameters
$ranges_to_split :

array

$split_start_time :

string HH:MM AM/PM

$split_end_time :

string HH:MM AM/PM

$new_properties : = []

array

Return values
array<string|int, mixed>

strtotime()

Runs strtotime over a string, but if it happens to be an epoch, strtotime returns -1, so in this case, just return the epoch again.

public static strtotime( $str) : int
Parameters
$str :
Return values
int

_get_month_long_names()

private static _get_month_long_names() : array<string|int, mixed>
Return values
array<string|int, mixed>

_get_month_short_names()

private static _get_month_short_names() : array<string|int, mixed>
Return values
array<string|int, mixed>

incrementDateGetOtherMonth()

Helper function for incrementDate() to make sure 31-Mar-2021 and minus 1 month from it gets 28-Feb-2021 rather than 01-Mar-2021 or something.

private static incrementDateGetOtherMonth( $date_arr,  $amount) : false|mixed|string
Parameters
$date_arr :
$amount :
Return values
false|mixed|string

Search results