How to get current date and time in MySQL datetime format using PHP

To get current date and time in PHP, you can use the date function which returns the current timestamp according to the defined format.

echo date("Y-m-d H:i:s");

This prints current date and time in MySQL datetime format.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *