×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Dylan Lopez
Added: Nov 23, 2017 10:03 AM
Views: 5
Tags: no tags
The PHP strtotime() function is used to convert a human readable string to a Unix time.
  1. $d=strtotime("10:30pm April 15 2014");
  2. echo "Created date is " . date("Y-m-d h:i:sa", $d);
  3.  
  4. $d=strtotime("tomorrow");
  5. echo date("Y-m-d h:i:sa", $d) . "<br>";
  6.  
  7. $d=strtotime("next Saturday");
  8. echo date("Y-m-d h:i:sa", $d) . "<br>";
  9.  
  10. $d=strtotime("+3 Months");
  11. echo date("Y-m-d h:i:sa", $d) . "<br>";