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

=Time( ) How can I remove seconds from the table?

Status
Not open for further replies.

murphy123

Technical User
Feb 18, 2006
41
US
Hello,

I've read dozens of postings but I didn't find what I was looking for. I have a form with a field named TIME STAMP and the default value is =Time() formatted as Medium Date. I only need hour/min. However, in the table the TIME STAMP field also stores the seconds.

This form tracks calls received. What I want to do later is run a parameter query to enter a specific time (hour/min), then my DATE field to see the hours that the most phone calls were received.

Is there anyway that I can have my table field to be formatted to show only hour and minute? I tried to format TIME STAMP in the table as Medim Date and it didn't work. The seconds are still being stored.

I appreciate all your help.
 
I suppose you could modify the table to remove the seconds
Code:
UPDATE myTable SET myTimeField = 
DateAdd("s", -DatePart("s", myTimeField), myTimeField)
But its probably easier to just ignore the seconds.
Code:
Select Format(myTimeField,"hh:nn") As HM
     , Count(*) As NumberOfCalls

From myTable

Group By Format(myTimeField,"hh:nn")
 
Hi Golom,

Thanks so much for the quick response. I created the query based on your code and added a couple of parameters that I needed. It works great!!

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top