another time mystery

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
In this statement:
"INSERT INTO logins(accountid,userid,login,jobdesc)  

How do I add an hour to NOW() ?
I tried NOW+60*60, but it adds 37 minutes, which makes no sense at all.

Re: another time mystery

meltedown wrote:
Quoted text here. Click to load it
I found a web page that explained it

"INSERT INTO logins(accountid,userid,login,jobdesc)  
values($preaccountid,$userid,adddate(NOW(),interval 1 hour),'$jobdesc')");

Re: another time mystery

Quoted text here. Click to load it

    adddate(now(), INTERVAL 1 HOUR)

adddate() and subdate() are very useful functions.

Quoted text here. Click to load it

What you got makes plenty of sense if you expand it out and treat
the result AS INTEGERS (not dates).  You don't want to add dates
like this.  Carries from seconds to minutes, minutes to hours, hours
to days, days to months, and months to years don't work right.

23:30:53 October 4, 2005

        20051004233053 + 3600 = 20051004236653

Now interpret that as a date, and you get 23:66:53 October 4, 2005 .
Doesn't look like a valid date, does it?  You can also get such nice
things as October 86, 2005, and nonexistent months.

                    Gordon L. Burditt

Site Timeline