PHP code example of assoconnect / php-date
1. Go to this page and download the library: Download assoconnect/php-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/ */
assoconnect / php-date example snippets
// A given point in time
$datetime = new \DateTime('@0'); // 1970-01-01 00:00:00+00:00
// The date was 1970-01-01 in Paris at the Epoch time
\AbsoluteDate::createInTimezone(new \DateTimeZone('Europe/Paris'), $datetime); // 1970-01-01
// The date was still 1969-12-31 in Los Angeles at the same point in time
\AbsoluteDate::createInTimezone(new \DateTimeZone('America/Los_Angeles'), $datetime); // 1969-12-31
// Default Y-m-d format
new \AbsoluteDate('1970-01-01'); // 1970-01-01
// Custom format
new \AbsoluteDate('1970/01/01', 'Y/m/d'); // 1970-01-01