Dynadot โ€” .com Registration $8.99

PHP / Date help

Spaceship Spaceship
Watch

w1ww

Established Member
Impact
9
Hello,

Imagine that I want to know what will be the date on the Thursday of week #27 of an year?

For example, now is week #27, year 2008 and the date on Thursday was 03-07-2008 (dd-mm-yyyy).

How can I do that?

Thanks in advance,
Tiago
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
PHP:
<?php

function week($year, $week, $day)
{
	/**
	* Day is the # of the day, ex:
	*
	* 1 - Monday
	* 2 - Tuesday
	* 3 - Wednesday
	* 4 - Thursday
	* 5 - Friday
	* 6 - Saturday
	* 7 - Sunday
	*/
    return date('m/d/Y', strtotime("$year-W$week-$day"));
}

// returns: 07/03/2008
echo week(2008, 27, 4);

?>
 
0
•••
Many thanks, I will give it a try!
 
0
•••
Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back