how to get current date in php code example
Example 1: php get current date and time
$today = date("F j, Y, g:i a");
$today = date("D M j G:i:s T Y");
$today = date("Y-m-d H:i:s");
Example 2: return current date in javascript
let today = new Date().toLocaleDateString()
console.log(today)
Example 3: php get day from date
$timestamp = strtotime('2009-10-22');
$day = date('D', $timestamp);
var_dump($day);
Example 4: php date timestamp now
$date = date('Y-m-d H:i:s');
$date = date('Y/m/d H:i:s');
$date = '2012-03-06 17:33:07';
$date = '2012/03/06 17:33:07';
date_default_timezone_set('Africa/Nairobi');
$date = date('Y-m-d H:i:s');
$date = date('Y/m/d H:i:s');
Example 5: php get current time and date
date("Y-n-j G:i:s");
Example 6: php get date
date("Y-m-d h:i:sa")