Add Time Interval to Date Script

Add Time Interval to Date Script is use to add the Day or Hour or Minute or Second to a original date.

Demo :



Date  Day   Hour   Minute   Second   

Code :

Following code is used to Add Time Interval to Date Script code if you need to copy and use to your website.

<?php
  $dateStr = "2011-02-01 00:00:00";
  $timestamp = strtotime($dateStr);
  $intSecs = 11 + (25*60) + (5*60*60) + (28*24*60*60);
  $newDateStr = date("Y-m-d h:i:s", $timestamp + $intSecs);
  echo $newDateStr;
?>

In the above $dateStr variable is used to assign a original date and $timestamp variable is used to convert time to string.The next step add to a Seconds + Minutes + Hours + Days and those are store $intSecs variable. The next step plus a $timestamp variable into $intSecs variable.Finally print the output here.

Free Download Script :

If you need Add Time Interval to Date Script click and download from following link.

Download




Content