Re: date time problem

From: Date: Sun, 06 Oct 2013 22:36:34 +0000
Subject: Re: date time problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-322243@lists.php.net to get a copy of this message
You should use gmdate() if you want to how many hours left to expire $time_left = gmdate("H:i:s",$diff); Best Regards Farzan Dalaee > On Oct 7, 2013, at 1:49, Jim Giner <jim.giner@albanyhandball.com> wrote: > > I always hate dealing with date/time stuff in php - never get it even close until an hour or > two goes by.... > > anyway > > I have this: > > // get two timestamp values > $exp_time = $_COOKIE[$applid."expire"]; > $curr_time = time(); > // get the difference > $diff = $exp_time - $curr_time; > // produce a display time of the diff > $time_left = date("h:i:s",$diff); > > Currently the results are: > exp_time is 06:55:07 > curr_time is 06:12:03 > the diff is 2584 > All of these are correct. > > BUT time_left is 07:43:04 when it should be only "00:43:04". > > So - where is the hour value of '07' coming from?? And how do I get this right? > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#322243) next »