Reply to Re: another time mystery

Your name:

Reply:


Posted by Gordon Burditt on 11/16/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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация