How to tell if after a certain time

Gkirkup

Registered User.
Local time
Today, 09:37
Joined
Mar 6, 2007
Messages
628
I have records that are posted at many times of the day. At present with just a date. I need to be able to count those records that are posted in 'overtime' - after a certain time. Can I do that? I know there is a date and time option for a control. Is there just a time option, that I can query and filter later?

Robert
 
Your requirement isn't clear.

If you are recording a value when a "record is posted", you could use Now() as that value. Now gives date and time.
Perhaps you could give us a sample, and a few more details.
 
Yes, I am recording the time that the record is posted. I could use Now(), but that gives a date and time. Is there a way I can just query the time in Now(). I don't care what the date is.

Robert
 
Well if you have a field/control PostedDate whose value is say Aug 23 2015 13:05:36

You could use something like

format(PostedDate,"hh:nn:ss") to get just the time.
 
Last edited:
Yes, I am recording the time that the record is posted. I could use Now(), but that gives a date and time. Is there a way I can just query the time in Now(). I don't care what the date is.

Robert

Robert,

It is best Practice to store the date and time together. This actually makes things a lot easy.

You could use Format to get just the time part but unfortunately ir returns a string which is not really what you want. Then you have must use CVDate() to convert it back to the correct data type.

A better solution is to use the TimeValue() function to return just the time from a date/time data type.


Example in a query criteria: for between 5:00:00 PM and 11:59:59 PM

Code:
WHERE ((TimeValue([filed_time_stamp]) Between  TimeSerial(17,0,0) And TimeSerial(23,59,59));
 

Users who are viewing this thread

Back
Top Bottom