Skip to content

Instantly share code, notes, and snippets.

@ryansukale
Last active January 4, 2016 20:19
Show Gist options
  • Select an option

  • Save ryansukale/8673645 to your computer and use it in GitHub Desktop.

Select an option

Save ryansukale/8673645 to your computer and use it in GitHub Desktop.
Php Script demonstrating how to add/subtract dates
$timeInterval = 10;
$timeFactor = 'seconds'; //Can be either 'days', 'hours', 'minutes' or 'seconds'
$now = date("Y-m-d H:i:s");
$futureDate = date('Y-m-d H:i:s', strtotime($now. ' + '. $timeInterval .' '.$timeFactor));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment