Find any day before a given date using php

This tutorial will help you in finding any day before a given date using simple php trick.Just look at the code below.
The script will take the server date as current day and will negate it against the number of days provided. Here i have given 1. You can give any number according to your convenience.

$previous_day = date('m/d/Y', strtotime('-1 days'));
echo $previous_day;

Here our output will be 04/18/2011 [SINCE I HAVE RUN IT ON 04/19/2011]

Click to rate this tutorial!
[Total: 3 Average: 4.7]

Leave a Reply

Your email address will not be published. Required fields are marked *