Date Time Question

  • Thread starter Thread starter ggonella
  • Start date Start date
G

ggonella

Hi,
How do I group by date in a query if the Date and Time is combined?

James
 
If the purpose of the query is to provide data for a report, don't. Let the
report's sorting and grouping options do it. You can group by hours, days,
weeks, months, etc., there.

If you need it for some other reason, use the Fix function to strip out the
time part. Something like:

JustTheDate: Fix([YourDateField])

Of course this will just leave you with a number like 37330. To make it look
like a date again, you can use format or the CDate function.

JustTheDate: Format(Fix([YourDateField]),"Short Date")
 
Hi,
How do I group by date in a query if the Date and Time is combined?

James

Put a calculated field in the query defined as

JustTheDate: DateValue([datetimefield])

and group by it.

John W. Vinson[MVP]
 
Thanks to both of you, it works and I can export the queries to Excel.
James
John said:
Hi,
How do I group by date in a query if the Date and Time is combined?

James

Put a calculated field in the query defined as

JustTheDate: DateValue([datetimefield])

and group by it.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top