Solved

Get Day name from date

Posted on 2014-12-08
5
39 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 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 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This collection of functions covers all the normal rounding methods of just about any numeric value.
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

895 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

19 Experts available now in Live!

Get 1:1 Help Now