echo date('Y-m-d H:i:s');
echo date('l, F jS Y \a\t g:ia');
$date = date('Y-m-d H:i:s'); $query = "INSERT INTO mytable (timestamp) VALUES ('$date')";Output: The current date and time is saved to the `timestamp` column in the `mytable` table in a MySQL database. PHP `date()` function is a built-in function and does not require any package library.