Pull the Day of Week out of a Date

R

Ripper

I have a combo box where people select a start and end dat of a report. I
have the bound column set to the short date 9/4/09 and another column set to
the Long Date format Friday September 4, 2009. I set it up that way for the
user as they need to make the report from a Monday to a Friday and I didn't
want them to have to consult a calendar.

The long date, however, gets verbose. I was wondering if there was a way to
pull out only the day of the week in the second column. Any tips?
 
J

Jeff Boyce

Exactly "how" will depend where (e.g., in a query, in a form, ...) you are
trying to do this.

Take a look at the Format() function -- I believe you could specify "dddd"
to see "day of week". There is also (see ACCESS HELP) a function related to
day-of-week that returns the name of the day, rather than the number ...

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
B

Bob Quintal

I have a combo box where people select a start and end dat of a
report. I have the bound column set to the short date 9/4/09 and
another column set to the Long Date format Friday September 4,
2009. I set it up that way for the user as they need to make the
report from a Monday to a Friday and I didn't want them to have to
consult a calendar.

The long date, however, gets verbose. I was wondering if there
was a way to pull out only the day of the week in the second
column. Any tips?

These functions may help

Public Function LastDayOfWeek(ByVal mydate As Date, Optional FDOW As
Integer = 1)
LastDayOfWeek = DateAdd("d", 7 - Weekday(mydate, FDOW), mydate)
End Function

Public Function FirstDayOfWeek(ByVal mydate As Date, Optional FDOW As
Integer = 1)
FirstDayOfWeek = DateAdd("d", 1 - Weekday(mydate, FDOW), mydate)
End Function

FDOW is
1 Sunday (default)
2 Monday
3 Tuesday
etc..
 

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