Jump to content

Archived

This topic is now archived and is closed to further replies.

gerkintrigg

Time stamps & comparing them

Recommended Posts

Hi everyone!

I'm trying to write a script that grabs info from a database where the timestamp of the SQL field is 6 months old or earlier.

Can anyone help? My brain's fried. :o(

cheers,
gerk

Share this post


Link to post
Share on other sites
[code]<?php
$timestamp = time()-15768000;
$query = mysql_query("SELECT * FROM whatever WHERE date>='{$timestamp}'");
?>[/code]

Try something like that. I'm now sure if that is what you mean.

15768000 = 60*60*24*365/2 - which is a half year (six months).
14515200 = 60*60*24*7*4*6 (six months based on four weeks per month).

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.