date from timestamp php code example

Example 1: php timestamp to date

<?php 
echo date('m/d/Y H:i:s', 1541843467); 
?>

Example 2: php timestamp to date

<?php 
echo date('m/d/Y H:i:s', 1541843467); 
?>

Example 3: php date object to timestamp

$date = new DateTime();
echo $date->getTimestamp();

Example 4: how to set date in php

// 1. create a date instance
$date = new DateTime;

// 2. set the date using the setDate(year, month, date) method on the
//    $date instance
$date->setDate(1999,02,19);

Example 5: php timestamp

<?php
$nextWeek = time() + (7 * 24 * 60 * 60);
                   // 7 days; 24 hours; 60 mins; 60 secs
echo 'Now:       '. date('Y-m-d') ."\n";
echo 'Next Week: '. date('Y-m-d', $nextWeek) ."\n";
// or using strtotime():
echo 'Next Week: '. date('Y-m-d', strtotime('+1 week')) ."\n";
?>