My script reports the time with a six minute error added to the current time. I can't figure out why.
I wrote a different script for solar calculation and get a 7 minute error subtracted. I'm hoping a response to this post will help me solve both problems.
I abbreviated the six minute error script to simplify the problem.
=====================================================
date_default_timezone_set("America/New_York");
$date = new DateTime();
$date4 = new DateTime();
echo(date("Y-m-d H:i:s"))." date\n";
$now = new DateTime();
$timestring = $now->format('Y-m-d H:i:s');
echo($timestring)." timestring\n";
$date2=date_create(date("y-m-d"));
$date4=date_create(date("y-m-d"));
date_add($date,date_interval_create_from_date_string("0 Hours"));
date_add($date4,date_interval_create_from_date_string("06 Hours"));
echo date_format($date2,"Y-m-d, H:m:s")." date2\n";
echo date_format($date4,"Y-m-d, H:m:s")." date4\n";
=======================================================