Tuesday 31 March 2015

How to Get Day name using DateTime in C#


In this post, I am going to tell how to get the day name of selected date using DateTime in C#.

Ex :1
 Get Day Name of Today
 DateTime.Today.DayOfWeek.ToString()

Output : Tuesday

Ex 2:

Get Day Name of selected date

1. Add Either days to current date
    DateTime.Today.AddDays(1);
2. Then add DayOfWeek to that DateTime.Today.AddDays(12).DayOfWeek.ToString()

   Output : Wednesday



Happy Coding:)

No comments:

Post a Comment