Question : php datetime object get unix timestamp
Answered by : taylor-hawkes
$date = new DateTime();
echo $date->getTimestamp();
Source : https://www.php.net/manual/en/datetime.gettimestamp.php | Last Update : Wed, 08 Apr 20
Question : php unix timestamp
Answered by : you
<?php
// Get current Unix timestamp
$timestamp = time();
// Convert Unix timestamp to date and time
$date = date('Y-m-d H:i:s', $timestamp);
// Output the results
echo "Current Unix timestamp: " . $timestamp . "\n";
echo "Date and time: " . $date . "\n";
?>
Source : | Last Update : Tue, 19 Sep 23