I am using DataAssist and eCart to handle a user pass renewal system with php and MySQL. I am stuck with calculating dates and need some direction from a fellow member of the forum. I have been echoing the values on screen simply for testing purposes so that I can verify my math before doing the record update. My understanding is that using TimeStamp the dates are stored in seconds.
I need to be able to:
1) Calculate the new Expiry Date (in a format ready for record update to db schema table) NewActivationDate=TodaysDate+(NewPassLength+RemainingPassLength)
2) Calculate the days remaining in a Pass (display as whole number on screen for user)
After doing the calculations, I know how to do the update using DataAssist record update server behavior. That part is easy, allows additional control with session variables that the standard update record behavior does not have and it works.
With this code:
echo strtotime($row_WAATKtblmembers['passActivation']), "\n";
echo strtotime($row_WAATKtblmembers['passExpireDate']), "\n";
Outputs to screen the following:
However, a simple math calc:
$datetoday = $_SERVER['REQUEST_TIME'];
$passExpireDate = $row_WAATKtblmembers['passExpireDate'];
$passDaysRemaining = ($passExpireDate - $datetoday);
I expected a positive value like 777600 however, it Outputs to screen the following negative value: -1252332020