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;

...so 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!

Recommended Answers

All 2 Replies

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.