To Display Day When Enter a Date in TextBox

Sabarimahesh
Posted by Sabarimahesh under C# category on | Points: 40 | Views : 1221
--------------------------------------------------------------------------------------------------------------------------------------------------------
INPUT
--------------------------------------------------------------------------------------------------------------------------------------------------------

 DateTime start = Convert.ToDateTime(textBox3.Text.ToString());


--------------------------------------------------------------------------------------------------------------------------------------------------------
To Display a Day(eg:Monday,Tuesday....)
--------------------------------------------------------------------------------------------------------------------------------------------------------
 textBox4.Text = start.DayOfWeek.ToString();


--------------------------------------------------------------------------------------------------------------------------------------------------------
To Diaplay a Day Of the Year(Eg:08/12/2011.............. O/P:342)
--------------------------------------------------------------------------------------------------------------------------------------------------------
textBox2.Text = start.DayOfYear.ToString();



--------------------------------------------------------------------------------------------------------------------------------------------------------
To Display a Month (Eg:08/12/2011.... O/P:12)
--------------------------------------------------------------------------------------------------------------------------------------------------------
textBox1.Text = start.Month.ToString();


--------------------------------------------------------------------------------------------------------------------------------------------------------
To Display a Day(Eg:08/12/2011.... O/P:08)
--------------------------------------------------------------------------------------------------------------------------------------------------------
textBox1.Text = start.Day.ToString();



--------------------------------------------------------------------------------------------------------------------------------------------------------
To Display a Year(Eg:08/12/2011.... O/P:2011)
--------------------------------------------------------------------------------------------------------------------------------------------------------
textBox1.Text = start.Year.ToString();

Comments or Responses

Login to post response