The-Last-Escape Posted May 3, 2007 Share Posted May 3, 2007 Ok, I am getting the date like this $date = strtotime(date()); ok, there you have it, a Unix time stamp of the time, date, and everything else. From here, is this the best way to do calculations. Like if I wanted to tell when 48 hours had passed from this date, how do I go about doing that. I know for example if you wanted to add a day, you check on how many "number's" here are in a day and put + that number onto the strength. Can someone tell me some stuff about this, so I am more familiar with dates, before I start all of these calculations. Link to comment https://forums.phpfreaks.com/topic/49810-data-calculations/ Share on other sites More sharing options...
thedarkwinter Posted May 3, 2007 Share Posted May 3, 2007 Hi you may want to look at the funtion mktime(): http://uk.php.net/mktime Using this u can do things like mktime(date("h"),date("i"),date("s")+10) to add 10 seconds to the current time etc,or $date = time() + mktime(0,0,0,0,2,0); will return now + 2 days. Hope that helps, cheers tdw Link to comment https://forums.phpfreaks.com/topic/49810-data-calculations/#findComment-244318 Share on other sites More sharing options...
The-Last-Escape Posted May 3, 2007 Author Share Posted May 3, 2007 Thanks Link to comment https://forums.phpfreaks.com/topic/49810-data-calculations/#findComment-244319 Share on other sites More sharing options...
Barand Posted May 3, 2007 Share Posted May 3, 2007 $now = time(); $nowPlus48 = strtotime('+48 hours'); echo date('m/d/Y H:i', $nowPlus48); http://www.php.net/strtotime Link to comment https://forums.phpfreaks.com/topic/49810-data-calculations/#findComment-244320 Share on other sites More sharing options...
The-Last-Escape Posted May 3, 2007 Author Share Posted May 3, 2007 Cheers Link to comment https://forums.phpfreaks.com/topic/49810-data-calculations/#findComment-244325 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.