[thelist] Displaying info according to date

Paul Bennett paul at teltest.com
Thu Jun 26 17:46:07 CDT 2003


Andre Genic wrote:

>Hi boys and girls, I've been trying to work on something, basically cos I
>don't know how to do it, so I thought a few days of messing around might
>lead to something productive, alas it didn't.
>
>What I'm trying to do, is add information to a table and then retrieve
>everything up to a date point, I've tried a few things like using $now =
>$date and using a formatted date in the sql query, but no luck, I'm storing
>dates like this $date = date("M jS Y"); you probably get the idea.
>  
>
Andre, I had a similar conundrum a few moons ago and found to my joy the 
strtotime() function which takes a date and converts it into the number 
of seconds since Jan 01 1970. Basically if you use this for time related 
apps, it gives you an exact (to the second) benchmark against which you 
can select and compare timed entries. Then your sql may be:
"SELECT * from $table where timestamp >= '$my_first_timestamp' and 
timestamp <= '$my_last_timestamp'";
This would give you the range of entries between 2 times

>
>  
>


-- 
 ------------------------------
	Paul Bennett						
	Internet Developer				
	Teltest Electronic Design		
 ------------------------------			
Email: paul at teltest.com				
Phone: 64 4 237 4557					
Web: http://www.teltest.com		
Wap: http://wap.teltest.com			




More information about the thelist mailing list