PHP code example of francerz / datetime-tools

1. Go to this page and download the library: Download francerz/datetime-tools library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

francerz / datetime-tools example snippets


class DateTimeHelper
{
    public static function toDateTime($datetime): ?DateTime;

    public static function toDateTimeImmutable($datetime): ?DateTimeImmutable;

    public static function max($datetimes): ?DateTime;

    public static function min($datetimes): ?DateTime;
}

class DateIntervalHelper
{
    public static function create($y = 0, $m = 0, $d = 0, $h = 0, $i = 0, $s = 0);
}

class DateTimeRange
{
    public function __construct($start, $end);

    public function getStart(): ?DateTime;

    public function getEnd(): ?DateTime;

    public function intersect($datetime): bool;

    public function intersectRange(DateTimeRange $range, bool $withoutLimit = false): bool;

    public function getRangeIntersect(DateTimeRange $range): DateTimeRange|null;

    public function countSeconds(): int;
    
    public function countWeekDays(): int[];
}