Anele Ngqandu

Anele Ngqandu

  • NA
  • 19
  • 38.6k

Find day of the week by inserting date in format dd/MM/yyyy

Oct 14 2011 12:16 PM

Hi guys
 
I want to get day of the week by inserting the date but using format dd/MM/yyyy
 
Now this is what i did..
 
Session["StartDate"]=09/10/2011
string ddMMyyyyFormat = Session["StartDate"].ToString();//Date in dd/MM/yyyy
string MMddyyyFormat =Convert.ToDateTime(ddMMyyyyFormat).ToString("MM/dd/yyyy");
                    
DateTime MMddyyyyDate = Convert.ToDateTime(MMddyyyFormat);
string dayOfWeek = MMddyyyyDate.DayOfWeek.ToString();
 
Now i get the day of the week as "Saturday" because its not converted to format MM/dd/yyyy


Answers (4)