Substract 1 hour from current date in PHP

This 3 lines will give you the current date minus 1 hour:

  1. $date = date("d-m-Y H:i");
  2. $newdate = strtotime ( ‘-1 hour’ , strtotime ( $date ) ) ;
  3. $newdateStr = date (‘d-m-Y H:i’ , $newdate );

Tags: , , ,

Comments are closed.