Converting numeric date to string, then trimming it

S

Santiago Gomez

I have a table with a date field. I need to group it by month.
I was thinking I could turn the number (37178) into a string (14-Oct-01) and
then trim the left3 and right 3 to just leave Oct.
Then I could group it by month.

Is there a better way of doing this?

what would the SQL statement look like?

thanks
 
A

Allen Browne

Create two calculated fields in your query:
ThisYear: Year([MyDate])
ThisMonth: Month([MyDate])
Group by those fields.

If this query is the source for a report, the Sorting And Grouping dialog is
capable of grouping by month.
 
V

Van T. Dinh

Easier than you think:

?Format(37178, "mmm")
Oct

Use Allen's Month & Year for Sorting and Grouping in Reports.
 
S

Santiago Gomez

Thanks that worked.

Van T. Dinh said:
Easier than you think:

?Format(37178, "mmm")
Oct

Use Allen's Month & Year for Sorting and Grouping in Reports.
 

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

Top