0

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!

2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by BonaDrag
0

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;
0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.