?
Solved

Compare DayOfWeek

Posted on 2007-07-30
4
Medium Priority
?
686 Views
Last Modified: 2008-01-09
Hi Experts,

Having problem compare the day of the week

Dim strDayOfWeek = "Monday"

IF Now.DayOfWeek = strDayOfWeek THEN <-- HOw to compare?

END IF

Can you please help?

TIA!
0
Comment
Question by:allanau20
4 Comments
 
LVL 14

Expert Comment

by:steveberzins
ID: 19596149
DayOfWeek is an enumeration...

so this would work

If DateTime.Now.DayOfWeek = DayOfWeek.Monday Then
0
 
LVL 12

Accepted Solution

by:
craskin earned 500 total points
ID: 19596164
just use Now.DayOfWeek.ToString

without the ToString, it just returns a number from 0 to 6.
0
 
LVL 2

Assisted Solution

by:drekow
drekow earned 500 total points
ID: 19596171
if now.dayofweek.tostring = strdayofweek then
     'do something here
end if

i would also convert them both to toupper to be on the safe side

if now.dayofweek.tostring.toupper = strdayofweek.toupper then
     'do something here
end if

Hope that helps

Dale
0
 
LVL 5

Author Comment

by:allanau20
ID: 19596532
Ahh, yes I was looking for the .toString. Thanks.
I'll split the points.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

850 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