Reputation: 2134
I am building a WPF application using C# in visual studio 2010 in .NET4. I have placed 2 datePickers on the window to select two different dates (or same dates). When I try to fetch the selected dates, I get the same date from both the datePickers, whatever the case may be, both of them return the current date.
Please help me.Am I missing something?
datePicker1.DisplayDate.ToString("MM/dd/yyyy");
Edit: The DisplayDate property is also fixed to today's date. Why? How can I remove it?
Upvotes: 0
Views: 638
Reputation: 377
You could post your code, but all you need shoud be something like:
DateTime date = datePickerDate.SelectedDate.Value.Date;
depending on the type of validation you also want to provide regarding nulls, for instance (you can just use .SelectedDate or SelectedDate.Value dependind on the types you want)
Upvotes: 1