Question

I have a simple telerik:RadDatePicker.

<telerik:RadDatePicker ID="dpDueDate" runat="server"  Culture="English (United States)" Width="180px" BorderStyle="None">
     <DateInput DateFormat="d-MMM-yyyy" DisplayDateFormat="d-MMM-yyyy" DisabledStyle-ForeColor="#505050" Enabled="false"/>
</telerik:RadDatePicker>

When I am debugging my web application I see that dpDueDate.SelectedDate has US format (12/05/2012) but when I open Firebug I see:

<input ... value="2012-12-05">

I have specified Culture="English (United States)", I have also tried Culture="en-US", I have set the culture of the RadDatePicker in PageLoad event. It doesn't help. I need to get the RadDatePicker value with JS and compare with value which I have got earlier on server side (it means that my server side value is 12/05/2012 and JS value is 2012-12-05). How can I make RadDatePicker to have value format like MM/dd/yyyy?

Was it helpful?

Solution

I found a solution. I take RadDatePicker value, create a variable of type Date (var date = new Date(DatePicker value)), then convert it like

var convertedDate = date.format('MM/dd/yyy');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top