The easiest way I found to do this is using mktime().
If you don't care about the time for the date you can use this...
$yesterday = mktime(0,0,0,date("m"),date("d")-1,date("Y"));
This translates to yesterday morning after midnight.
If you want the present time, only 24 hours before, use this...
I have a feeling that saving it as a numeric field would be quicker. Numeric
fields are generally quicker than alphanumeric fields and the date field in
mySQL has the format of -mm-dd, so it probably does some error
checking/validation to see the format is correct and also it contains
alphanu
You should be working with UNIX timestamps here. Convert the dates to human
readble only after you've done the calcuations.
-Kevin
- Original Message -
From: "Patrick" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 23, 2002 2:38 PM
Subject: [PHP] date functions
>
When/If you read the PHP manual, you'll discover that the second parameter
MUST be a timestamp; not a text string.
- Original Message -
From: Norman Zhang <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 02, 2002 2:17 PM
Subject: [PHP] date
Hi,
I am doing a test with the
4 matches
Mail list logo