EchoFool Posted April 2, 2010 Share Posted April 2, 2010 Hey similiar to how mysql has a datediff() is there PHP version where you can choose it to either turn in minutes/days or what ever you choose something like: function comparedate($Timestamp,servertime()){} Link to comment https://forums.phpfreaks.com/topic/197320-compare-timestamp-to-now/ Share on other sites More sharing options...
teamatomic Posted April 2, 2010 Share Posted April 2, 2010 $servertime=date("U"); if($Timestamp > $servertime) {echo "Future";} else {echo "Past";} HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/197320-compare-timestamp-to-now/#findComment-1035705 Share on other sites More sharing options...
ignace Posted April 2, 2010 Share Posted April 2, 2010 date_diff Link to comment https://forums.phpfreaks.com/topic/197320-compare-timestamp-to-now/#findComment-1035788 Share on other sites More sharing options...
EchoFool Posted April 2, 2010 Author Share Posted April 2, 2010 Okay date_diff seems over complex compared to mysql's method. Link to comment https://forums.phpfreaks.com/topic/197320-compare-timestamp-to-now/#findComment-1035884 Share on other sites More sharing options...
ignace Posted April 2, 2010 Share Posted April 2, 2010 Depends on what you consider complex. echo date_diff($timestamp)->format('%d days %i minutes'); Link to comment https://forums.phpfreaks.com/topic/197320-compare-timestamp-to-now/#findComment-1036001 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.