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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Output time between two different dates

Status
Not open for further replies.

mlrmlr

Technical User
Mar 17, 2006
168
US
Hi,

I'm sure for you experts out there this is a no brainer, but I am stumped on this one.

Can someone show me how to output data between 8:30 AM on 5/29/06 and 8:30 AM on 5/30/06?

Thanks?
 
Something like this (SQL code) ?
WHERE [your DateTime field] BETWEEN #2006-05-29 08:30:00# And #2006-05-30 08:29:59#

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PH,

Thank you so much for responding. I don't thinik I am arranging this statement correctly. Here is what I am workikng with.

[SQL CODE]
SELECT log_table.log_id AS ID, log_table.enter_date AS [Enter Date], log_table.enter_time AS [Enter Time]
FROM log_table

WHERE (((log_table.enter_date) Between [Forms]![criteria_export_trouble_tkt_records_dialog]![BeginDate] And [Forms]![criteria_export_trouble_tkt_records_dialog]![EndDate]) AND ((log_table.fsd_project)="Growth"))
ORDER BY log_table.enter_date, log_table.enter_time;

Thanks again. :)
 
Why using 2 fields (enter_date, enter_time) for storing a single DateTime value ?

Anyway, you wanted something like this ?
PARAMETERS [Forms]![criteria_export_trouble_tkt_records_dialog]![BeginDate] DateTime
, [Forms]![criteria_export_trouble_tkt_records_dialog]![EndDate] DateTime;
SELECT log_id AS ID, enter_date AS [Enter Date], enter_time AS [Enter Time]
FROM log_table
WHERE ((enter_date + enter_time) Between [Forms]![criteria_export_trouble_tkt_records_dialog]![BeginDate] And [Forms]![criteria_export_trouble_tkt_records_dialog]![EndDate])
AND fsd_project = 'Growth'
ORDER BY (enter_date + enter_time);

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi PH,

Should I store date and time as one field? This is the first time I used the date/time function.

The SQL code did not output any data. It prompted me with the parameter form but when I entered the start and end dates there were no output.

Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top