How do I add two hours to this code?
I tired this but it actually displays the time with a "+2" in the center of it.PHP Code:$date = date("Y-m-d");
$time = date("g+2:i a");
PHP Code:$date = date("Y-m-d");
$time = date("g+2:i a")+2;
How do I add two hours to this code?
I tired this but it actually displays the time with a "+2" in the center of it.PHP Code:$date = date("Y-m-d");
$time = date("g+2:i a");
PHP Code:$date = date("Y-m-d");
$time = date("g+2:i a")+2;
Last edited by Dirt_Diver; 01-09-2009 at 02:56 AM.
I would just do something like:
PHP Code:<?php
$date = date("Y-m-d ");
$time = date("g:i a", strtotime("+2 hours"));
echo $date.$time;
?>
Last edited by Nile; 01-09-2009 at 02:52 AM.
Jeremy | jfein.net
Dirt_Diver (01-09-2009)
I also tired this but got a fatal error
PHP Code: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]
Jeremy | jfein.net
Dirt_Diver (01-09-2009)
Ahhh yes thanks again Buddy.
Bookmarks