php function month(date) code example
Example 1: php week of a date
Things to be aware of when using week numbers with years.
<?php
echo date("YW", strtotime("2011-01-07"));
echo date("YW", strtotime("2011-12-31"));
echo date("YW", strtotime("2011-01-01"));
?>
BUT
<?php
echo date("oW", strtotime("2011-01-07"));
echo date("oW", strtotime("2011-12-31"));
echo date("oW", strtotime("2011-01-01"));
?>
Reason:
Y is year from the date
o is ISO-8601 year number
W is ISO-8601 week number of year
Conclusion:
if using 'W' for the week number use 'o' for the year.
Example 2: phph 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));
?>