xxxxxxxxxx
<?php
echo date('m/d/Y H:i:s', 1541843467);
?>
//Output:
11/01/2022 09:51:07
xxxxxxxxxx
<?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";
?>
xxxxxxxxxx
$timestamp = 1609459200; // Example timestamp
// Convert timestamp to a string representation
$dateString = date("Y-m-d H:i:s", $timestamp);
echo $dateString; // Output: 2021-01-01 00:00:00
xxxxxxxxxx
$unix_timestap = microtime(true);
$date_time = gmdate("Y-m-d\TH:i:s\Z", (int)$unix_timestap);
xxxxxxxxxx
<?php
//Y-M-D formate :-
$date = "2020-09-23";
$timestamp1 = strtotime($date);
echo $timestamp1;
echo "<br>";
//D-M-Y formate
$date2 = "24-09-2020";
$timestamp2 = strtotime($date2);
echo $timestamp2;
echo "<br>";
//British English words Formate
$date3 = "16 May 2019";
$timestamp3 = strtotime($date3);
echo $timestamp3;
?>
//Output:
1600819200
1600905600
1557964800