[thelist] Displaying info according to date
Aredridel
aredridel at nbtsc.org
Thu Jun 26 10:58:40 CDT 2003
> Putting the information in is no problem, it's just the retrieval, what I'm
> trying to achieve is being able to add stuff to a site a few days in advance
> or a week in advance, then when the right day comes along, everything in the
> table gets displayed up to todays date etc, apart from the stuff that hasn't
> reached it's due date.
I always make sure that I use a date field that lets me do integer math
on it: If the date is stored as a unix timestamp (that is, seconds since
1970, 32-bits, or seconds since 1900, 64-bits), one can do things like
select * from table where date <= now()
to find entries that are to be shown, and post-dated entries can be
inserted with:
insert into table values(..., now() + 14000)
14000 seconds is three hours. 604800 is a week. (60 * 60 * 24)
Ari
>
> Hope you can understand what I mean, cos I'm starting to lose the plot with
> this one.
>
> Andre.
More information about the thelist
mailing list