Hi,
I have two date pickers:
FROM and TO.
PKd
I have two date pickers:
FROM and TO.
I'd like to know if the two dates are further than 3 days apart. How do I do this comparison? Is there a more efficient way than this?
var date = datePickerFrom.GetDate();
date.setDate(date.getDate() + 3);
var toDate = datePickerTo.GetDate();
if( toDate <= date )
.....
Thanks for your help.
PKd
4 Answers, 1 is accepted
0
Alex Peachey
Top achievements
Rank 1
answered on 15 Jan 2008, 01:50 AM
I don't think there is anything built into the controls themselves but I imagine you could do something like:
if ((datePickerTo.GetDate() - datePickerFrom.GetDate()).Days > 3)
{
...
}
if ((datePickerTo.GetDate() - datePickerFrom.GetDate()).Days > 3)
{
...
}
0
Hi Phuong,
Thank you for writing.
We don't have this feature built-in RadDateTimePicker for WinForms. Could you please verify you are using RadDateTimePicker for WinForms? The reason I'm asking is that there is no GetDate method there.
The Value property is used to get/set the date/time in RadDateTimePicker. You can use the following code snippet as an example:
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thank you for writing.
We don't have this feature built-in RadDateTimePicker for WinForms. Could you please verify you are using RadDateTimePicker for WinForms? The reason I'm asking is that there is no GetDate method there.
The Value property is used to get/set the date/time in RadDateTimePicker. You can use the following code snippet as an example:
if (this.radDateTimePicker1.Value.Day - this.radDateTimePicker2.Value.Day > 3)
{
// To Do
}
Do not hesitate to write, if you have more questions.
Kind regards,
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Phuong
Top achievements
Rank 1
answered on 15 Jan 2008, 01:37 PM
Thank you for your replies.
In response to Alex's reply, I tried that and it did not work... could be my mistake in a typo or something.
Boyko,
I am using the RadDatePicker, not RadDateTimePicker. Is the .value property still available to me then? If so, then that's very useful.
Thanks,
PKd.
In response to Alex's reply, I tried that and it did not work... could be my mistake in a typo or something.
Boyko,
I am using the RadDatePicker, not RadDateTimePicker. Is the .value property still available to me then? If so, then that's very useful.
Thanks,
PKd.
0
Hello Phuong,
Could you please give me more information about the control you are using. What would you like to accomplish with it? The Value property is available in RadDateTimePicker. You should use it if you want to get/set the current date in RadDateTimePicker.
In our WinForms suite we have a control named RadDateTimePicker, which is closely related to the RadCalendar control. You can find more information about them at: http://www.telerik.com/products/winforms/controls/calendar/overview.aspx.
I'm looking forward to your reply.
Regards,
Boyko Markov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Could you please give me more information about the control you are using. What would you like to accomplish with it? The Value property is available in RadDateTimePicker. You should use it if you want to get/set the current date in RadDateTimePicker.
In our WinForms suite we have a control named RadDateTimePicker, which is closely related to the RadCalendar control. You can find more information about them at: http://www.telerik.com/products/winforms/controls/calendar/overview.aspx.
I'm looking forward to your reply.
Regards,
Boyko Markov
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center