There is a magic little function called strtotime()... it takes just about
any english phrase, and acts on it... there are examples in the manual:

In this case, I'm guessing you'd want

$yesterday = strtotime('yesterday');

Another approach would be to get the current time stamp (or any time stamp),
and minus 24 hours from it:

60 seconds * 60 minutes * 24 hours = 86400 seconds.

$yesterday = time() - 86400;

Either way, you've got a timestamp (seconds since some date in 1970)
representing yesterday, which you can feed into date():

echo date('l',$yesterday);
echo date('d',$yesterday);
echo date('D',$yesterday);

etc etc

Justin French

on 18/08/02 11:38 AM, Kenton Letkeman ([EMAIL PROTECTED]) wrote:

> I have been able to get yesterdays date
> eg. $yesterday = date('d')-1;  result is "17"
> but am having trouble getting yesterdays day of the week.
> eg. $yesterday = date('D')-1;  result is "-1"
> eg. $yesterday = date('l')-1;  result is "-1"
> Is there something I am missing?  I cannot find the documentation on this.

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to