Q:

Write a PHP script to get yesterday's date

0

Write a PHP script to get yesterday's date.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

<?php
$dt = new DateTime();
$dt->sub(new DateInterval('P1D'));
echo $dt->format('F j, Y')."\n";
?>

Sample Output:

July 10, 2017

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now