Method |
Description |
|
__construct ( $time = null, $tz = null ) |
{@inheritDoc} |
|
age ( integer | string $start, integer | string | null $end = null ) : integer |
Calculates the age using start and optional end date. |
|
ageBounds ( integer $firstAge, integer | null $secondAge = null, boolean $returnAsString = false, string | null $relativeTime = null ) : array |
Get the age bounds (min, max) as timestamp that would result in the given age(s)
note: expects valid age (> 0 and < 120) |
|
ageByHoroscope ( integer $year, integer $sign ) : integer | array |
Returns age by horoscope info. |
|
ageByYear ( integer $year, integer | null $month = null ) : integer | string |
Returns the age only with the year available
can be e.g. 22/23 |
|
ageRange ( integer $year, integer | null $month = null, integer | null $day = null, integer $steps = 1 ) : mixed |
Rounded age depended on steps (e.g. age 16 with steps = 10 => "11-20")
FIXME
TODO: move to helper? |
|
buildDefaultTime ( integer $duration ) : string |
Return strings like 2:33:99 from seconds etc |
|
buildTime ( integer | DateInterval $duration, string $format = 'H:MM:SS' ) : string |
Returns nicely formatted duration difference
as string like 2:30 or 2:30:06. |
|
cWeek ( mixed | null $dateString = null, integer $relative ) : string |
Calendar Week (current week of the year). |
|
cWeekBeginning ( integer $year, integer $cWeek ) : integer |
Calculate the beginning of a calender week
if no calendar week is given get the beginning of the first week of the year |
|
cWeekEnding ( integer $year, integer $cWeek ) : integer |
Calculate the ending of a calenderweek
if no cweek is given get the ending of the last week of the year |
|
cWeekMod ( integer $num ) : integer |
Get number of days since the start of the week. |
|
cWeeks ( integer | null $year = null ) : integer |
Calculate the amount of calender weeks in a year |
|
convertDate ( string $oldDateString, string $newDateFormatString, integer | null $timezone = null ) : string |
Convenience method to convert a given date |
|
dayAsSql ( integer | string | DateTime $dateString, string $fieldName, string | DateTimeZone | null $timezone = null ) : string |
Returns a partial SQL string to search for all records between two times
occurring on the same day. |
|
dayName ( integer $day, boolean $abbr = false, integer $offset ) : string |
Return the translation to a specific week day |
|
dayNames ( array $dayKeys = [], array $options = [] ) : array |
Weekdays |
|
daysAsSql ( integer | string | DateTime $begin, integer | string | DateTime $end, string $fieldName, string | DateTimeZone | null $timezone = null ) : string |
Returns a partial SQL string to search for all records between two dates. |
|
daysInMonth ( integer $year, integer $month ) : string |
Return the days of a given month. |
|
decimalToStandardTime ( integer $value, string | null $pad = null, string $decPoint = '.' ) : string |
Hours, minutes
e.g. 9.5 => 9.3
with pad=2: 9.30 |
|
difference ( mixed $startTime, mixed | null $endTime = null, array $options = [] ) : integer |
Calculate the difference between two dates |
|
duration ( integer | DateInterval $duration, string $format = '%h:%I:%S' ) : string |
Returns nicely formatted duration difference
as string like 2:30 (H:MM) or 2:30:06 (H:MM:SS) etc. |
|
fuzzy ( integer $timestamp ) : string |
Returns the difference between a time and now in a "fuzzy" way. |
|
fuzzyFromOffset ( integer $offset, boolean | null $past = null ) : string |
|
|
getGmtOffset ( string | DateTimeZone | null $timezone = null ) : integer |
Calculate the current GMT offset from a timezone string (respecting DST) |
|
hasDaylightSavingTime ( string | DateTimeZone | null $timezone = null ) : boolean |
Detect if a timezone has a DST |
|
incrementDate ( mixed $startDate, integer $years, integer $months, integer $days, string | DateTimeZone | integer | null $timezone = null ) : object |
Handles month/year increment calculations in a safe way, avoiding the pitfall of "fuzzy" month units. |
|
isDayAfterTomorrow ( string $dateString, integer | null $timezone = null ) : boolean |
Returns true if given datetime string is the day after tomorrow. |
|
isInRange ( string $dateString, integer $seconds ) : boolean |
For birthdays etc |
|
isInTheFuture ( string $dateString, integer | null $timezone = null ) : boolean |
Returns true if given datetime string is not now AND is in the future. |
|
isNotTodayAndInTheFuture ( string $dateString, integer | null $timezone = null ) : boolean |
Returns true if given datetime string is not today AND is in the future. |
|
lengthOfTime ( integer $seconds, string | null $format = null, array $options = [] ) : string |
Time length to human readable format. |
|
localDate ( string | null $dateString = null, string | null $format = null, array $options = [] ) : string |
Outputs Date(time) Sting nicely formatted (+ localized!) |
|
monthName ( integer $month, boolean $abbr = false, array $options = [] ) : string |
Return the translation to a specific week day |
|
monthNames ( array $monthKeys = [], array $options = [] ) : array |
Months |
|
niceDate ( string | null $dateString = null, string | null $format = null, array $options = [] ) : string |
Outputs Date(time) Sting nicely formatted |
|
niceTime ( string $time ) : string |
Takes time as hh:mm:ss or YYYY-MM-DD hh:mm:ss |
|
pad ( string $value, integer $length = 2, string $string = '0' ) : string |
TimeLib::pad() |
|
parseLocalDate ( string $date, array $allowed = ['.', '-'] ) : integer |
Parse 2022-11-12 or 12.11.2022 or even 12.11.22 |
|
parseLocalTime ( string $duration, array $allowed = [':', '.', ','] ) : integer |
Parse 2,5 - 2.5 2:30 2:31:58 or even 2011-11-12 10:10:10
now supports negative values like -2,5 -2,5 -2:30 -:30 or -4 |
|
parseLocalizedDate ( string $date, string | null $format = null, string $type = 'start' ) : string |
Try to parse date from various input formats
- DD.MM.YYYY, DD/MM/YYYY, YYYY-MM-DD, YYYY, YYYY-MM, . |
|
period ( string $searchString, array $options = [] ) : array |
Parse a period (from . |
|
periodAsSql ( string $searchString, string $fieldName, array $options = [] ) : string |
Return SQL snippet for a period (beginning till end). |
|
relLengthOfTime ( mixed $date, string | null $format = null, array $options = [] ) : string |
Time relative to NOW in human readable format - absolute (negative as well as positive)
TODO: make "now" adjustable |
|
standardToDecimalTime ( integer $value ) : float |
Hours, minutes
e.g. 9.3 => 9.5 |
|
timezoneByCoordinates ( float $lat, float $lng ) : DateTimeZone |
Gets the timezone that is closest to the given coordinates |
|
tzOffset ( integer $gmtoffset, boolean $isDst ) : integer |
EXPERIMENTAL!!! |
|
wasDayBeforeYesterday ( string $dateString, integer | null $timezone = null ) : boolean |
Returns true if given datetime string was day before yesterday. |
|