473,699 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

another time mystery

In this statement:
"INSERT INTO logins(accounti d,userid,login, jobdesc)
values($preacco untid,$userid,N OW(),'$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 1276
meltedown wrote:
In this statement:
"INSERT INTO logins(accounti d,userid,login, jobdesc)
values($preacco untid,$userid,N OW(),'$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(accounti d,userid,login, jobdesc)
values($preacco untid,$userid,a dddate(NOW(),in terval 1 hour),'$jobdesc ')");
Oct 5 '05 #2
>In this statement:
"INSERT INTO logins(accounti d,userid,login, jobdesc)
values($preacc ountid,$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
1877
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, I had many flatten functions at hand. So I had to time them. Results below. History of the functions (from flattrial.py): # There are three basic features:
12
1507
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 have a time filed along with 2 other fields formatted like this >> 1231 23 56 1232 25 79 1234 26 88
5
2940
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 error on this code (that has previously worked without exception): >>> time.strftime("%Y-%m-%d", (Y, M, D, 0,0,0,0,0,0)) Traceback (most recent call last):
51
4052
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 DotNetJunkies.com also. -------------------------------------------------------------------------- YEP, DOTNET JUNKIES REDESIGN....
0
1764
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 in a datasheet. The user double clicks on a row in that datasheet and a main form (pop up) opens bound to a table with a continuous subform bound to a query.
2
2108
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 of the records in their forms (Datasheet view) are showing up as "#Deleted", though no one should be deleting records from here. Further, the messages show up only on certain users' screens. Is this a result of corruption from having multiple...
188
7179
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 - non-deterministic destructors - Objects can't exist on the stack - Type / Reference Types
10
5257
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 public static double GetHoursofYear( DateTime aTime ) { DateTime StartYear = new DateTime( aTime.Year, 1, 1 ); return ( aTime.ToOADate() - StartYear.ToOADate() ) * 24;
14
2787
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 have running a fairly simple HTTP server (written in python) that i
13
16169
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 local time from UTC function formatToLocalTimeDate(inDate) { var today = new Date(); var inDateMod = new Date(inDate);
0
8705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8623
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9196
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8941
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4390
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.