Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting records based on system time

Status
Not open for further replies.

nospace52

Technical User
Jan 28, 2003
27
US
I'm deleoping a web page which pulls data from a Access data base. The data has a begin and end date. Example of SQL is Select * from table2 where Data() between Begin and End; - The begin and end dates are on a Tuesday of each week. When I pull data on the page on Tuesdays there are 2 Begin and End dates. How can I only pull the begin date on the Tuesday when the time = 12 Noon.
Data
Begin = 01/07/2003 End = 01/14/2003
Begin = 01/14/2003 End = 01/21/2003

Thanks
 
This?

Begin = #01/07/2003 12:00 PM# End = #01/14/2003 11:59:59 PM#
Begin = #01/14/2003 12:00 PM# End = #01/21/2003 11:59:59 PM#
Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048

mikewolf@tst-us.com
 
mwolfoo - thanks - Where would I put the
Begin = #01/07/2003 12:00 PM# End = #01/14/2003 11:59:59 PM#
Begin = #01/14/2003 12:00 PM# End = #01/21/2003 11:59:59 PM#
in the SQL Select * from Table2 where date() between Begin and End. Or would I put the Begin = #01/07/2003 12:00PM# in the database as text and then pull the information from there ?
 
Are your dates stored in the database with dat and time? (I hope so - 'cause you can't do this if they aren't)

Your query should look like...

SELECT * FROM table2 WHERE dateField BETWEEN #01/07/2003 12:00 PM# AND #01/14/2003 11:59:59 AM# Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048

mikewolf@tst-us.com
 
The Begin and End are set as Data Type = Date/Time and the Format is General Date. < I want to work in Theory - everything and everybody works in Theory !!>
 
Does the query in my last post work?
When you look at the data in the begin and end columns, do you just see dates? or dates AND times?
Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048

mikewolf@tst-us.com
 
I just see the Date - no Date and Time. I have tried several things to get the web page to pull the date and time but all I see is the date when using the DATE().

Thanks < I want to work in Theory - everything and everybody works in Theory !!>
 
It sounds like only the date was entered when someone populated the table. Therefore, you cannot determine what was put in before or after noon....

In asp, if someone used this to add the line...
objCN.execute(&quot;INSERT INTO myTable (dateField) VALUES (#&quot; & date() & &quot;#)&quot;)

Then the only got the date (date()). You should use the value now() which returns date and time. Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048

mikewolf@tst-us.com
 
mwolf00 - thanks for the help. I built the .MDB file and
put the dates and times in but if I use NOW() nothing is pulled back. In Access help when I pull up NOW() this is what is explained:
Returns the serial number of the current date and time whenever the sheet changes.

Syntax

NOW( )

< I want to work in Theory - everything and everybody works in Theory !!>
 
Oops! You need to format that!

objCN.execute(&quot;INSERT INTO myTable (dateField) VALUES (#&quot; & formatDateTime(now(), 0) & &quot;#)&quot;) Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048

mikewolf@tst-us.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top