php date time code example
Example 1: date now php
date('Y-m-d H:i:s')
Example 2: date php
$today = date("F j, Y, g:i a");
$today = date("m.d.y");
$today = date("j, n, Y");
$today = date("Ymd");
$today = date('h-i-s, j-m-y, it is w Day');
$today = date('\i\t \i\s \t\h\e jS \d\a\y.');
$today = date("D M j G:i:s T Y");
$today = date('H:m:s \m \e\s\t\ \l\e\ \m\o\i\s');
$today = date("H:i:s");
$today = date("Y-m-d H:i:s");
Example 3: php time format
$today = date("F j, Y, g:i a");
$today = date("m.d.y");
$today = date("j, n, Y");
$today = date("Ymd");
$today = date('h-i-s, j-m-y, it is w Day');
$today = date('\i\t \i\s \t\h\e jS \d\a\y.');
$today = date("D M j G:i:s T Y");
$today = date('H:m:s \m \i\s\ \m\o\n\t\h');
$today = date("H:i:s");
$today = date("Y-m-d H:i:s");
Example 4: php format date
<?php
$old_date_format = "20/03/1999";
$new_data_format = date("Y-m-d H:i:s", strtotime($old_date_format));
Example 5: php datetime
$dateTime = new \DateTime();
$dateTime->format('Y-m-d H:i:s');
Example 6: datetime php
date_format ( DateTimeInterface $object , string $format )
$dateTime = new \DateTime();
$dateTime->format('y-j-d H:i:s T');
date('g:i A m-d-Y', strtotime($date_time));