?
Solved

get the name of the day such as monday.

Posted on 2004-11-09
5
Medium Priority
?
141 Views
Last Modified: 2010-05-02
I am trying to get the day of the week returned programmatically visual basic.
I know how to get the date and time stamp. What I need it to tell me is the date, time and the day of the week.  Then I can schedule due dates for projects that span over a weekend.
I know there is the calendar control but I am not using any forms for this project so I do not know what to do
Thanks
.
0
Comment
Question by:shayne23d
  • 3
  • 2
5 Comments
 
LVL 32

Expert Comment

by:Erick37
ID: 12538200
'Get the day of the week (1 to 7)
Debug.Print Weekday(Now, vbSunday)
0
 
LVL 32

Expert Comment

by:Erick37
ID: 12538226
'Get the day of the month
Debug.Print DatePart("d", Now)
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 12538240
msgbox  Format(Now, "dddd, mmmm dd, yyyy")
0
 
LVL 48

Accepted Solution

by:
Mikal613 earned 500 total points
ID: 12538248
Printing Formatted Dates and Times
To print formatted dates and times, use the Format function with symbols representing date and time. These examples use the Now and Format functions to identify and format the current date and time. The following examples assume that the Regional Settings dialog box of the Windows Control Panel is set to "English(United States)".

Format syntax Result
Format(Now, "m/d/yy") 1/27/93
Format(Now, "dddd, mmmm dd, yyyy") Wednesday, January 27, 1993
Format(Now, "d-mmm") 27-Jan
Format(Now, "mmmm-yy") January-93
Format(Now, "hh:mm AM/PM") 07:18 AM
Format(Now, "h:mm:ss a/p") 7:18:00 a
Format(Now, "d-mmmm h:mm") 3-January 7:18


By using the Now function with the format "ddddd" and "ttttt, " you can print the current date and time in a format appropriate for the selection in the Regional Settings dialog box of the Windows Control Panel
0
 
LVL 32

Expert Comment

by:Erick37
ID: 12538268
'Get the name of the weekday
Debug.Print WeekdayName(Weekday(Now, vbSunday), False)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

839 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