Solved

Get Day name from date

Posted on 2014-12-08
5
33 Views
Last Modified: 2016-07-12
Hi Experts

In VBA how can I get the day name when specifying a date.
So how can I extract the day name from now()
e.g. Monday etc.

Thanks
0
Comment
Question by:simsima_7876
  • 2
5 Comments
 
LVL 26

Accepted Solution

by:
MacroShadow earned 250 total points
ID: 40486881
Format(Now(),"dddd")

Open in new window

0
 
LVL 26

Expert Comment

by:Shaun Kline
ID: 40486884
You can use the Weekday function to get the day of the week from a date, and then use the WeekdayName function to get the name.
0
 
LVL 26

Expert Comment

by:MacroShadow
ID: 40486904
Just to be clear for the OP , this is what Shaun Kline suggested:
WeekdayName(Weekday(Now()))

Open in new window

0
 
LVL 49

Assisted Solution

by:Gustav Brock
Gustav Brock earned 250 total points
ID: 40486996
That won't work in an international environment, except if extended:

    strWeekday = WeekdayName(Weekday(Date), , vbSunday)

So Format is much simpler and easier:

    strWeekday = Format(Date, "dddd")

/gustav
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
This collection of functions covers all the normal rounding methods of just about any numeric value.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now