How do I make a calendar show a date that I fetch from another control? The fetched date is 'date' and will be different every time.

To show the current date I do this:

CalendarMyMeetings.SelectedDate = System.DateTime.Today; I'm guessing I need to replace 'Today' with 'date', but I just can't get it to work.

I've tried:
CalendarMyMeetings.SelectedDate = System.DateTime(date);
CalendarMyMeetings.SelectedDate = System.DateTime.(date);
CalendarMyMeetings.SelectedDate = System.DateTime.Convert.ToDateTime(date);

and some other variations as well. Thankful for help!

If date is of type DateTime you can do:

CalendarMyMeetings.SelectedDate = date;

If your date has another format, convert it to year, month and day and use:

DateTime mydate = new DateTime(year, month, day);
CalendarMyMeetings.SelectedDate = mydate;

That seems to work, I just have to fix some other things before I can test it. Thanks a bunch!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.