473,407 Members | 2,359 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,407 software developers and data experts.

Searching a datetime field by time

I have the time of an event stored on each record as a datetime field.It
includes the year,month,day, etc. Suppose my user wants to search the table
for all events over the lunch hour, say between11am and 1pm. How do I
construct the SELECT query to peek into each datetime field and return only
those records that satify the specified time range?

Many thanks.
Jan 12 '06 #1
3 1789
"Andrew Chalk" <ac****@magnacartasoftware.com> wrote in
news:Pg***************@newssvr11.news.prodigy.com:
I have the time of an event stored on each record as a datetime
field.It includes the year,month,day, etc. Suppose my user wants to
search the table for all events over the lunch hour, say between11am
and 1pm. How do I construct the SELECT query to peek into each
datetime field and return only those records that satify the specified
time range?

Many thanks.

Scary. Really scary.
select * from Events
where datpart(hh,evt_time) between 11 and 13

Jan 12 '06 #2
Thanks.
"Eric J. Holtman" <ej*@ericholtman.com> wrote in message
news:Xn*******************************@216.168.3.3 0...
"Andrew Chalk" <ac****@magnacartasoftware.com> wrote in
news:Pg***************@newssvr11.news.prodigy.com:
I have the time of an event stored on each record as a datetime
field.It includes the year,month,day, etc. Suppose my user wants to
search the table for all events over the lunch hour, say between11am
and 1pm. How do I construct the SELECT query to peek into each
datetime field and return only those records that satify the specified
time range?

Many thanks.

Scary. Really scary.
select * from Events
where datpart(hh,evt_time) between 11 and 13

Jan 12 '06 #3
"Andrew Chalk" <ac****@magnacartasoftware.com> wrote in news:u1Bxf.210$F_
3.**@newssvr29.news.prodigy.net:

I screwed it up. If you really want everything between 11 and 1,
you want
select * from Events
where datpart(hh,evt_time) between 11 and 12

Jan 13 '06 #4

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

Similar topics

2
by: andrew lowe | last post by:
Hi, Please bear with me on this problem, first I'll give you some background: I have an object that contains a DateTime field which i pass to a webservice public class Foo { public DateTime...
6
by: Carl | last post by:
Hi, to be use with SQL server database 1- From window form textbox object From this assignement, txtTOTAL.Text="0.00m"; How do you convert back to decimal type ? How do you assign a...
1
by: RML | last post by:
Hi everyone, I am using VB.NET 2003 and an OleDBDataAdapter to update an Access table's DateTime field. The field's format is set to "General Date" (ie: 11/24/2004 8:00:00 AM). The problem is...
9
by: Phil B | last post by:
I am having a problem with a datetime from a web services provider The provider is sending the following SOAP response <?xml version="1.0" encoding="utf-8"?> <soap:Envelope...
33
by: Geoff Jones | last post by:
Hiya I have a DataTable containing thousands of records. Each record has a primary key field called "ID" and another field called "PRODUCT" I want to retrieve the rows that satisy the following...
2
by: elena | last post by:
Hi, All Please, i need help with cast string to DateTime: DateTime dt = new DateTime(2006,09,17); it works i can update Field in Access DB Next field is Short Time data type, how i can cast...
2
by: Ryan | last post by:
My form includes a field of the DateTime type. I want to allow the user to be able to set both the date and the time. By default the DateTimePicker shows just the date and calendar, the time is...
3
by: john | last post by:
I am using MS Sql Express as the backend database for a Microsoft Access front end application. I am using a calendar control to store the desired date in the sql datetime field. The time...
1
by: remya1000 | last post by:
I’m using VB.net 2003 application program. I am trying to do a select statement whereby I'm searching between 2 datetime values that are being stored as datetime. records are stored inside...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.