PHP code example of joaomfrebelo / date

1. Go to this page and download the library: Download joaomfrebelo/date 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/ */

    

joaomfrebelo / date example snippets


    $date = \Rebelo\Date\Date::parse(
        \Rebelo\Date\Date::SQL_DATETIME, "1969-10-05 09:00:00"
    );

    OR

    $date = \Rebelo\Date\Date::createFromFormat(
        \Rebelo\Date\Pattern::DATE_TIME,
        "1969-10-05 09:00:00",
        new \DateTimeZone("Europe/Lisbon")
    );

    OR for Date now

    $date = new \Rebelo\Date\Date();

    OR get Date from NTP server

    $date = \Rebelo\Date\Date::ntp();

$string = $date->format(\Rebelo\Date\Pattern::SQL_DATE)

$date2 = $date->addYears(50);
$date3 = $date->addYears(-9)

$date->setMonth(9)