473,324 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

another time mystery

In this statement:
"INSERT INTO logins(accountid,userid,login,jobdesc)
values($preaccountid,$userid,NOW(),'$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.
Oct 5 '05 #1
2 1259
meltedown wrote:
In this statement:
"INSERT INTO logins(accountid,userid,login,jobdesc)
values($preaccountid,$userid,NOW(),'$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.

I found a web page that explained it
http://www.phpbuilder.com/board/show...oto=nextoldest

"INSERT INTO logins(accountid,userid,login,jobdesc)
values($preaccountid,$userid,adddate(NOW(),interva l 1 hour),'$jobdesc')");
Oct 5 '05 #2
>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
Oct 5 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Francis Avila | last post by:
A few days ago (see the 'itertools.flatten()?' thread from October 28) I became obsessed with refactoring a recursive generator that yielded the leaves of nested iterables. When the dust settled,...
12
by: MCD | last post by:
Hello, I'm new to python and this group and am trying to build some bins and was wondering if any of you could kindly help me out. I'm a bit lost on how to begin. I have some text files that...
5
by: Sheila King | last post by:
I have a web app that has been running just fine for several months under Python 2.2.2. We are preparing to upgrade the server to run Python 2.4.1. However, part of my web app is throwing an...
51
by: nospam | last post by:
THIS IS the DOTNETJUNKIES MESSAGE ------------------------- We're Sorry As many of you know we have recently launched SqlJunkies.com. We have overhauled our runtime and will be using it on...
0
by: William Wisnieski | last post by:
Hello Everyone: I'm having a very strange problem occurring with my Access 2000 database. I call it the "mystery record." Here's the story: I have a query by form that returns a record set...
2
by: maddman | last post by:
I have an odd problem with my database, and was hoping someone could point me at the problem. We have an access database that is used by several people to input data. Users have reported some...
188
by: christopher diggins | last post by:
I have posted a C# critique at http://www.heron-language.com/c-sharp-critique.html. To summarize I bring up the following issues : - unsafe code - attributes - garbage collection -...
10
by: Marc Pelletier | last post by:
Hello, I am writing an application that does some simple astronomical calculations. One of the variables I need is the number of hours passed in this year. I've written the following function ...
14
by: jojoba | last post by:
Hi, I hope this post is ok for this group. Here's my deal: I have two computers on my LAN at home. One desktop. One laptop. Both computers are wireless enabled (and wired enabled too). I...
13
by: maflatoun | last post by:
Hi, I have the following function to convert UTC time to Local time. It works perfect for GMT- (Minus) time zones however it provides incorrect results for GMT+(Plus) time zones? // Format to...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.