php - Adding minutes to date formatting syntax -


i having trouble adding time , time interval date.

i use javascript datepicker gives date in form: 05/06/2013

i can convert date time format

$eventdate = date("y-m-d h:i:s",strtotime($eventdate)); 

this gives: 2013-05-06 00:00:00

i time separate variable in minutes. 8 o'clock 480.

however, cannot seem find syntax add 480 minutes date.

have tried, example,

echo date("y/m/d h:i:s", strtotime("+480 minutes", $eventdate)); 

but gives me default 1969 date.

thanks or suggestions!

use datetime class, it's easier work with:

$eventdate = \datetime::createfromformat('y/m/d h:i:s', $eventdate); $eventdate->modify('+480 minutes');  echo $eventdate->format('y/m/d h:i:s'); 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -