iperez_genius Posted September 10, 2007 Share Posted September 10, 2007 I am looking for a way to determine the week of the year if i have a date. i know that date("W"); give me the week Number but not sure how to determine the week based on the date Ilan Link to comment https://forums.phpfreaks.com/topic/68644-date-and-week-question/ Share on other sites More sharing options...
phpfanphp Posted September 10, 2007 Share Posted September 10, 2007 That's tricky because it's a UNIX timestamp. Look up php unix timestamp and you might be able to find some great resources Link to comment https://forums.phpfreaks.com/topic/68644-date-and-week-question/#findComment-345102 Share on other sites More sharing options...
Fadion Posted September 10, 2007 Share Posted September 10, 2007 Actually if u have a date, lest say 5/21/2007, u can use date() and mktime() to calculate the week. Im giving a simple example: <?php $date = '5/21/2007'; list($month, $day, $year) = explode('/', $date); $week = date('W', mktime(0, 0, 0, $month, $day, $year)); echo $week; ?> Hope it makes sense and helps. Link to comment https://forums.phpfreaks.com/topic/68644-date-and-week-question/#findComment-345116 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.