blunder Posted July 20, 2007 Share Posted July 20, 2007 Can I somehow make $expiredate = date('Y-m-d h:s:m') + 24 hours? In my case the date will always be based on the current timestamp, but for future reference I would like to know if you can do it for other dates? Quote Link to comment Share on other sites More sharing options...
per1os Posted July 20, 2007 Share Posted July 20, 2007 $expiredate = date('Y-m-d h:s:m', time()+3600*24); Quote Link to comment Share on other sites More sharing options...
blunder Posted July 20, 2007 Author Share Posted July 20, 2007 So what if I have a specific date coming from a SQL Db, how do I turn it into a timestamp that I can play around with? Lets say I have a value coming from the db called $datefromdb, how do I compare the date with current datetime and say how many hours/etc still to go before I reach that specific date? Quote Link to comment Share on other sites More sharing options...
per1os Posted July 20, 2007 Share Posted July 20, 2007 www.php.net/strtotime Quote Link to comment Share on other sites More sharing options...
blunder Posted July 20, 2007 Author Share Posted July 20, 2007 So now I have $datefromdb is 2007-07-21 02:21:07. time() is 2007-07-20 03:43:07. $timeleft = date("h:s:m",strtotime($datefromdb)-time()); I cant get it to work, what am I doing wrong? Quote Link to comment Share on other sites More sharing options...
SharkBait Posted July 20, 2007 Share Posted July 20, 2007 <?php $date = date("d m Y", strtotime("+24 hours"); ?> Works for me Quote Link to comment Share on other sites More sharing options...
blunder Posted July 20, 2007 Author Share Posted July 20, 2007 Its not from the current date, but from the date collected in $datefromdb. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.