PHP provides a range of functions to work with date and time. Some useful functions are date()
, time()
, and strtotime()
.
To get the current date and time, use date()
:
<?php
echo date("Y-m-d H:i:s"); // Outputs current date and time
?>
To get the current Unix timestamp, use time()
: