Solved

Get Day name from date

Posted on 2014-12-08
5
53 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 27

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 27

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 50

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
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…

759 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