Just a couple of thoughts:
First, I know this particular topic has been discussed here recently, so you
might want to search the archives for more exhaustive information.

Second, if you're using MySQL, check out the functions DATE_ADD() and MOD().
They're MySQL functions, so you'll have to implement them in your query, not
the actual PHP code itself. These may or may not give you what you're
looking for. You might have to drop the value of some kind of PHP variable
into the DATE_ADD() INTERVAL parameter or something though.

I looked quickly through the date functions in the PHP documentation and
didn't find anything that would really manipulate the date for you (of
course I may have missed it). The one thing that I did notice is that the
PHP date and time functions return the SERVER date and time to you, not the
local time for the user accessing your page. That might not be what you
want. As I said before, I might have missed something, but that's what I
found out after looking for all of two minutes.

-----Original Message-----
From: Manoj Japher [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 21, 2002 2:23 PM
Subject: [PHP-DB] Date Subtraction

  Is there any way I can get previous day's date, like we get 
date by using getdate() or date() function. I mean is there some
in-built function in PHP which can subtract date to give me
yesterday's date.
  I am currently calculating it using some code, which I have 
and it is very tirng and recursive to check for each possible 

  If someone has solved this before pls let me know.




'I have miles to go before I sleep, and promises to keep'

PHP Database Mailing List (
To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to