c# equivalent for this DatePart("w", Now())

hi,

What is the equivalent C# for this vb code snippets:

DatePart("w", Now())
ube100Asked:
Who is Participating?
 
p_davisConnect With a Mentor Commented:
but with this monday is 1 and sunday is 7
0
 
p_davisCommented:
DateTime.Now.DayOfWeek.ToString();
//??
0
 
p_davisCommented:
is that to get the weekday?
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
are you looking for the DateOfWeek property?
http://msdn.microsoft.com/en-us/library/system.datetime_members.aspx
0
 
ube100Author Commented:
P Davis,

This is giving day of the week i.e. Thursday But I want the number for the particular day, for example if sunday that should retrun 1 , Monday should return 2 and so forth. Which what above VB function is doing and I don't know this is available in C#.
0
 
p_davisCommented:
Int32 i =(int) DateTime.Now.DayOfWeek;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.