date month php code example
Example 1: date now php
date('Y-m-d H:i:s')
Example 2: php all date formats
<?php
echo date("F j, Y, g:i a")."<br>";
echo date("m.d.y")."<br>";
echo date("j, n, Y")."<br>";
echo date("Ymd")."<br>";
echo date('h-i-s, j-m-y, it is w Day')."<br>";
echo date('\i\t \i\s \t\h\e jS \d\a\y.')."<br>";
echo date("D M j G:i:s T Y")."<br>";
echo date('H:m:s \m \i\s\ \m\o\n\t\h')."<br>";
echo date("H:i:s")."<br>";
echo date("Y-m-d H:i:s")."<br>";
Example 3: php days in month
echo cal_days_in_month(CAL_GREGORIAN, 1, 2021);
echo date('t');
Example 4: datetime get month php
$dateTime = new DateTime();
$month = $dateTime->format('m');
Example 5: get month days in php
echo cal_days_in_month(CAL_GREGORIAN, 8, 2009);
Example 6: php date
<?php
date_default_timezone_set('UTC');
echo date("l");
echo date('l jS \of F Y h:i:s A');
echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000));
echo date(DATE_RFC2822);
echo date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000));
?>