Re: Something wierd with time() and curdate()
| From: | Bobo Wieland | Date: | Mon, 01 Nov 2004 08:54:35 +0000 |
| Subject: | Re: Something wierd with time() and curdate() | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-37096@lists.php.net to get a copy of this message | ||
Thanks for trying to help me...
I just found out what the problem was... I use the number of seconds in a day (86400) as a constant Yesterday there wasn't 60*60*24 seconds in a day though... It was acctually 60*60*25 seconds... That's why the script flipped out at 11 pm... Also, in the spring time when we change the time again there will be 60*60*23 seconds... I think I'll live with this, since the script won't generate any serious error...
thanks again
_bobo
dev@elstudion.com
----- Original Message ----- From: "Jason Wong" <php-db@gremlins.biz>
To: <php-db@lists.php.net>
Sent: Monday, November 01, 2004 11:14 AM
Subject: Re: [PHP-DB] Something wierd with time() and curdate()
On Sunday 31 October 2004 22:45, Bobo Wieland wrote:There is something wierd going on over here... I have a date field, datum, in mysql that I cast to a timestamp and check against time(). If the datum value is more than one day old the table finds a new random row and sets the datum field to CURDATE(). Now, this has worked for two years now, but today the script suddenly finds a new random row each time the script is run...Would this line have anything to with it? If not, post some concise code (see below).mysql_data_seek($result, rand(0,$rows));I've notice this just after 11 pm today. As I can see from some debugging time() allways returns a higher value than the timestamp + 86400... Have I missed something in this script for the last couple of years or is there a bug somewhere? Could it have something to do with the fact that we turned the time back one hour last night? This is the code btw:Please *try* to isolate the problem and post CONCISE code which sufficiently illustrates your problem. For example (for this particular problem) if you suspect PHP is calculating the dates incorrectly then a few lines of code showing the date calculations would be sufficient. If you suspect MySQL is the culprit then a single query would be sufficient. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db ------------------------------------------ /* "There are things that are so serious that you can only joke about them" - Heisenberg */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php