Revision: 43916
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 3, 2011 04:15 by aristoworks
Initial Code
<?php
function week_number( $date = 'today' )
{
return ceil( date( 'j', strtotime( $date ) ) / 7 );
}
?>
Usage Example:
<?php
$week_num = week_number();
$month = date("J", time());
echo "Today is the $week_num week of $month";
?>
Initial URL
http://www.aristoworks.com
Initial Description
This simple function allows you to find a weeks position in the month based on a given date. For instance I needed to alert the user their date was the "Second Week Of January" during a given month. I may never use it again but it came in very handy for this particular project.
Initial Title
Find The Number Of A Week In A Month For A Given Date
Initial Tags
date, number
Initial Language
PHP