Add 1 hour to current DateTime in PHP - Call to a member function add() on a non-object -


i've tried multiple examples/questions around , far cannot work. trying take current datetime, add 1 hour, set minutes 30. here have:

current time:

$date = date('y-m-d h:i:s'); //this works , echos 

add hour:

$date->add(new dateinterval("pt1h")); 

i receive following error

call member function add() on non-object

then once done i'm planning add:

$date->format('y-m-d h:30:00'); //commented out on script until above piece working. 

date() not produce datetime() object required use datetime::add(). change:

$date = date('y-m-d h:i:s');  

to

$date = new datetime(); 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -