Jump to content

diffrence between two dates


Destramic

Recommended Posts

hey days im trying to get the differnce between the two dates but

 

		$start_date      = new DateTime($start_date);
	$todays_date     = new DateTime("now");

	$interval = $start_date->diff($todays_date);
	echo $interval->format('%R%a days');

 

but the error im getting is

 

Fatal error: Call to undefined method DateTime::diff()  i dont see what im doing wrong if someone could help please

 

thank you

Link to comment
https://forums.phpfreaks.com/topic/248839-diffrence-between-two-dates/
Share on other sites

ok all updated and these errors come up which i never seen before

 

Fatal error:  Uncaught exception 'Exception' with message 'DateTime::__construct() [<a href='datetime.--construct'>datetime.--construct</a>]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/London' for '1.0/DST' instead' in C:\www\private\application\controllers\tournaments_controller.class.php:30
Stack trace:
#0 C:\www\private\application\controllers\tournaments_controller.class.php(30): DateTime->__construct('2011-10-06')
#1 [internal function]: Tournaments_Controller->tournament('counter-strike', 'test')
#2 C:\www\private\library\action\action.class.php(47): call_user_func_array(Array, Array)
#3 C:\www\private\library\dispatcher\dispatcher.class.php(101): Action->dispatch('tournament', Array)
#4 C:\www\private\library\front_controller\front_controller.class.php(132):  in <b>C:\www\private\application\controllers\tournaments_controller.class.php</b> on line <b>30</b><br />

 

help please  :-[

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.