How to Subtract Minutes

php

Solution

Change the date into a timestamp (in seconds) then minus 15 minutes (in seconds) and then convert back to a date:

$date = date("Y-m-d H:i:s");
$time = strtotime($date);
$time = $time - (15 * 60);
$date = date("Y-m-d H:i:s", $time);

Problem

I want to send a reminder email.I don't want to use `cron` on Linux/Unix/BSD box or Scheduled Tasks on Windows. I'm trying to subtract 15 minutes from the current time. here is my code so far (doesn't work): ``` $days = date("j",time()); $months = date("n",time()); $years = date("Y",time()); $hours = date("G",time()); $mins = (date("i",time())); $secs = date("s",time()); $mins = $mins-15; ```

Original source

Related problems