Can you use time in a query?

katzi4eva

Registered User.
Local time
Today, 13:48
Joined
Nov 26, 2014
Messages
14
Hi,

Ive found alot of reference to using dates to find records but not time, I need a query to pull up records entered on that day before lunch time and another query will pull the records entered after lunch.

receipt date is date/time field
receipt time is date/time field

to get records for that day i use date() which works but cannot get the time part to work??

Please help!!!!:)
 
I think the best option for you may be Long Time actually :)

Hope this helps
 
Well think have maybe worked out one way of doing it,
for the afternoon query i have used

>Now() And <Now()+1 which only selected the record i had entered in the afternoon

and the morning one i just used <now() but it means i have to remember to run the queries at the right times!
 
you could also take the easy road and use : Time()

works the same as Date()

but obviously it displays time instead.
 
OK, next question!

my field "receipt date" is date/time, short date which in my table stores 27/11/2014, happy days!

when i export this data, it shows "receipt date" as 27/11/2014 00:00 - can i take out the 00:00 for the export?

:)
 
You can use timeserial function to "create" a time like: Timeserial(12,0,0) for noon.

Assuming your date/time field is one you can simply add date() to the timeserial to get the date/time
 
I should think that the format "dd/mm/yyyy" would do that would it?

if that's the format, time shouldn't be showing :)
 
Code:
SELECT DATE_FORMAT(date_column_here,'%d/%m/%Y') FROM table_name;
Try that one :)
 
proper daft question, where do i put that? in the query that i use to create the export?
 
By the way, Just for the information.

you need to create a query based on the table and export the query (using Format([Field],'dd-mm-yy')).

This is because exporting does not format the data. A Date/Time field is formatted as a real number which, when displayed, is treated as a Date/Time value and formatted as such. So the time will be displayed :)
 

Users who are viewing this thread

Back
Top Bottom