|
Posted by Gordon Burditt on 10/26/60 11:28
>In this statement:
>"INSERT INTO logins(accountid,userid,login,jobdesc)
>values($preaccountid,$userid,NOW(),'$jobdesc')")
>
>How do I add an hour to NOW() ?
adddate(now(), INTERVAL 1 HOUR)
adddate() and subdate() are very useful functions.
>I tried NOW+60*60, but it adds 37 minutes, which makes no sense at all.
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
Navigation:
[Reply to this message]
|