I don't store anything in date format (eg YYYY-MM-DD)... I store them as a
unix time stamp -- see time() in the manual.

Then it would be pretty easy to get today's stamp using time(), then look
for the two files preceeding that stamp, (ORDER BY in SQL) which would
presumably be today's file/row, and the one preceeding it (usually
yesterday, but could be a few days before).

something like:
SELECT * FROM table WHERE stamp < $now ORDER BY stamp DESC LIMIT 2

should give you the two stamps you need... a simular thing could be done
with other date formats in MySQL, but I've never worked with them sorry,


justin french





on 01/08/02 5:43 PM, Thomas Edison Jr. ([EMAIL PROTECTED]) wrote:

> hi!
> i have a problem in my project.the problem is that
> suppose we have the date for the whole of the month
> and two different files r there.
> i have to pick one file of the current date that is
> say today and the other file of the yesterday.but the
> problem is that if the current date is monday then the
> in yesterday file i have to pick for saturday and not
> the sunday.broadly speaking i mean to say that the
> difference between the today's date and yesterday's is
> not fixed as there can be a holiday for say 4 days
> inbetween then in yesterday i need the date 4 days
> before.
> so i need some query to handle this as soon as
> possible as its very urjent.the query should be in
> MYSQL.that is the query should be such which can pick
> today's date and the date of the working day before
> the today's or the current date.
> 
> =====
> Rahul S. Johari (Director)
> ******************************************
> Abraxas Technologies Inc.
> Homepage : http://www.abraxastech.com
> Email : [EMAIL PROTECTED]
> Tel : 91-4546512/4522124
> *******************************************
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Health - Feel better, live better
> http://health.yahoo.com


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to