Last Update : 02 November 2019
In this post we’ll take a quick lock at some date related functions/techniques in PHP.
List
Get current date in MySQL DATETIME format
date_default_timezone_set('Asian/Tehran');
$sqlNow = date('Y-m-d H:i:s');
In above sample, in the first line default Timezone is set to Tehran. Then, in the second line we use a format string and ask PHP date function to output the result DATETIME string.