View Full Version : Resolved Looking for an addition
Dirt_Diver
01-09-2009, 02:41 AM
How do I add two hours to this code?
$date = date("Y-m-d");
$time = date("g+2:i a");
I tired this but it actually displays the time with a "+2" in the center of it.
$date = date("Y-m-d");
$time = date("g+2:i a")+2;
I would just do something like:
<?php
$date = date("Y-m-d ");
$time = date("g:i a", strtotime("+2 hours"));
echo $date.$time;
?>
Dirt_Diver
01-09-2009, 02:48 AM
I also tired this but got a fatal error
date_default_timezone_set('America/New_York');
I've made an edit to my post, look above.
When using date_default_timezone_set, you also have to include a _get below it.
[From what I understand]
Dirt_Diver
01-09-2009, 02:55 AM
Ahhh yes thanks again Buddy.
Anytime, you could also use the mktime function if you wanted. ;)
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.