• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2299
  • Last Modified:

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

hi,

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

DatePart("w", Now())
0
ube100
Asked:
ube100
  • 4
1 Solution
 
p_davisCommented:
DateTime.Now.DayOfWeek.ToString();
//??
0
 
p_davisCommented:
is that to get the weekday?
0
 
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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
 
p_davisCommented:
but with this monday is 1 and sunday is 7
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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