Re: Can of worms re date

From: Date: Mon, 24 Jul 2000 20:06:13 +0000
Subject: Re: Can of worms re date
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-7956@lists.php.net to get a copy of this message
> I need to expire records in a database older than X days. > This would be easy, if my PHP was compiled with the additional date > functions for julian dates. > But, it wasn't. > > So, I have to either solve how to upgrade my PHP, or solve this without the > julian functions. If you store a Unix timestamp directly in the database: $CutoffDate = time() - (86400 * 7); // Seven days ago. mysql_query("DELETE FROM Table WHERE UnixTimestamp < $CutoffDate"); If you store a native date or datetime: mysql_query("DELETE FROM Table WHERE MyDateTime < FROM_UNIXTIME($CutoffDate)");

« previous php.general (#7956) next »