Add 5 weeks to time stamp

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
Burrito
Spockulator
Posts: 4715
Joined: Wed Feb 04, 2004 8:15 pm
Location: Eden, Utah

Post by Burrito »

damn it!

I just read more carefully

doh!

this is how it needs to be (to show hours)

Code: Select all

$now = date("m/d/Y g:i a");
echo date("m/d/Y g:i a",strtotime($now." +5 weeks 2 hours"));
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

same thing it keeps giving me 10/26/05 3:09 and 11/23/05 1:43 (this is supposed to be 4 weeks and two hours, because I changed the amount of weeks)
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

Burrito wrote:damn it!

I just read more carefully

doh!

this is how it needs to be (to show hours)

Code: Select all

$now = date("m/d/Y g:i a");
echo date("m/d/Y g:i a",strtotime($now." +5 weeks 2 hours"));
that's what I have
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

I thought it was working... but here's what it gives me... I put in 11/22/05 10:00 as my start date, and it gave me 11/23/05 1:49 as an end date... like 4 weeks and 11 minutes off.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

Here's the code:

Code: Select all

$this->startdate = date("n/j/y g:i", $this->start);
		if($this->sku == "SE08"){
			$this->enddate = date("n/j/y g:i",strtotime($startdate." +5 weeks 3 hours"));
		}
		else{
			$this->enddate = date("n/j/y g:i",strtotime($startdate." +4 weeks 2 hours"));
		}
        echo "$this->startdate and $this->enddate";
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

Works now... I am seriously retarded.
AGISB
Forum Contributor
Posts: 422
Joined: Fri Jul 09, 2004 1:23 am

Post by AGISB »

Code: Select all

$timestamp + (60 * 60 * 24 * 7 * 5 + (60 * 60 * 2))
wouldn't that just do it ?
Post Reply