PHP - Getting Current Timestamp [1]
Example #1
Code
$current_timestamp = time();
echo $current_timestamp;
Output
1737198380
Example #2
Code
$current_timestamp = strtotime("now");
echo $current_timestamp;
Output
1737198380
Example #3
Code
$date_from_timestamp = date("Y-m-d H:i:s",$current_timestamp);
echo "Formatted date from timestamp: " . $date_from_timestamp;
Output
Formatted date from timestamp: 2025-01-18 06:06:20