Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 74
  • Last Modified:

Get Day name from date

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
simsima_7876
Asked:
simsima_7876
  • 2
2 Solutions
 
MacroShadowCommented:
Format(Now(),"dddd")

Open in new window

0
 
Shaun KlineLead Software EngineerCommented:
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
 
MacroShadowCommented:
Just to be clear for the OP , this is what Shaun Kline suggested:
WeekdayName(Weekday(Now()))

Open in new window

0
 
Gustav BrockCIOCommented:
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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now