Setting a default date for a calendar

Anyone know how to set System.Web.UI.WebControls.Calendar to today's date?

and also how do I parse a dateTime value from the database to set the calendar?
Who is Participating?
jkrillConnect With a Mentor Commented:
System.Web.UI.WebControls.Calendar cal = new System.Web.UI.WebControls.Calendar();
cal.SelectedDate = DateTime.Now;

And to parse a DateTime string:

string myDateAsString = "1/1/2004";
DateTime aDate = DateTime.Parse(myDateAsString);
jayrodAuthor Commented:
once I reparse and get aDate.. can I use it the same way I use DateTime.Now to reset the calendar?
Yes.  DateTime.Now simply returns a DateTime object initialized with the current date and time.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.