NameSilo

PHP / Date help

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
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
Close
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
Close
Many thanks, I will give it a try!
 
0
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back