php datetime get day code example
Example 1: php get day from date
$timestamp = strtotime('2009-10-22');
$day = date('D', $timestamp);
var_dump($day);
Example 2: datetime php
$dateTime = new \DateTime();
$dateTime->format('Y-m-d H:i:s');
Example 3: datetime get month php
$dateTime = new DateTime();
$month = $dateTime->format('m');
Example 4: get day from date php
echo date("l") . "<br>";
Example 5: date time format php
$today = date("F j, Y, g:i a");
Example 6: how to check the day of any date in php
$date = $request->start_date;
$unixTimestamp = strtotime($date);
$dayOfWeek = date("l", $unixTimestamp);
$day = $date . ' fell on a ' . $dayOfWeek;