nick546 Posted February 25, 2012 Share Posted February 25, 2012 I am a coldfusion developer starting out in php. I am having trouble with dates. I just found out my server host is not supporting date_diff the host is running php5 can someone please help with an alternative I am trying to find out the difference between datetimes in seconds $interval = date_diff($fromdate, $todate); $secdiff = $interval->format('%s'); Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/257728-date_diff/ Share on other sites More sharing options...
requinix Posted February 25, 2012 Share Posted February 25, 2012 Get the dates as timestamps, like what you get from mktime() and strtotime(), and just subtract the two. Timestamps themselves are seconds so the difference between them is also in seconds. Quote Link to comment https://forums.phpfreaks.com/topic/257728-date_diff/#findComment-1320991 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.