This website uses Cookies to provide you with the best possible service. Please see our Privacy Policy for more information. Click the check box below to accept cookies. Then confirm with a click on "Save".  
Status: 2023-12-26

Date


dateIsBetween2Dates

checks if a simplified ISO-date (Y-m-d) lays in between two other simplified ISO-Dates (Y-m-d).

Date::dateIsBetween2Dates(string $sDateIsoRangeStart = '', string $sDateIsoRangeEnd = '', string $sDateIso = '') : bool

Example

$bDateIsBetween2Dates = Date::dateIsBetween2Dates(
    '2023-12-24', # start Date
    '2024-12-24', # End Date
    '2024-06-19'  # Date we are interested in
);

Result

// type: boolean
true

validateDate

checks if a requested value equals to the requested date format.

Date::validateDate(string $sValue, string $sFormat = 'Y-m-d H:i:s') : bool

Example

// true
Date::validateDate('2022-10-09', 'Y-m-d');

getWeekNumberOnIsoDate

gives the week number of the requested simplified ISO Date (Y-m-d).

// gives 52
Date::getWeekNumberOnIsoDate('2023-12-26');

getAmountOfWeekNumbersOfYear

gives the amount of week numbers of the requested year (YYYY).

Date::getAmountOfWeekNumbersOfYear(int $iYear = 0) : int

Examples


// gives 52
Date::getAmountOfWeekNumbersOfYear(); # if empty, the curent year is set

// gives 53
Date::getAmountOfWeekNumbersOfYear(2020);