Tuesday, March 31, 2009

Find current day, month and year by using c#

Here is the syntax to find current day, month and year by using c#.net

String TodayDate = DateTime.Now.Date.Day.ToString();
String Todaymonth = DateTime.Now.Date.Month.ToString();
String Todayyear = DateTime.Now.Date.Year.ToString();

--------showing day, month and year in text boxes---------------
Date.Text = TodayDate;
month.Text = Todaymonth;
year.Text = Todayyear;

Here is the out put sample.
day=1
Month=4
year=2009

No comments:

Post a Comment