php timestamp to date code example
Example 1: date php
$today = date("F j, Y, g:i a");
$today = date("m.d.y");
$today = date("j, n, Y");
$today = date("Ymd");
$today = date('h-i-s, j-m-y, it is w Day');
$today = date('\i\t \i\s \t\h\e jS \d\a\y.');
$today = date("D M j G:i:s T Y");
$today = date('H:m:s \m \e\s\t\ \l\e\ \m\o\i\s');
$today = date("H:i:s");
$today = date("Y-m-d H:i:s");
Example 2: php timestamp to date
<?php
echo date('m/d/Y H:i:s', 1541843467);
?>
Example 3: php datetime to timestamp
$time = '2021-03-31 23:59:00';
strtotime($time);
Example 4: php timestamp to date
<?php
echo date('m/d/Y H:i:s', 1541843467);
?>
Example 5: convert timestamp to date php
<?php
$date = new DateTime();
echo $date->format('U = Y-m-d H:i:s') . "\n";
$date->setTimestamp(1171502725);
echo $date->format('U = Y-m-d H:i:s') . "\n";
?>
Example 6: php date object to timestamp
$date = new DateTime();
echo $date->getTimestamp();