This is a migrated thread and some comments may be shown as answers.

Datetime picker different values in ie to firefox

2 Answers 124 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Craig Broadhead
Top achievements
Rank 1
Craig Broadhead asked on 18 Oct 2012, 09:15 AM
Using the datetime picker I am getting a different value back between IE and firefox:

in IE i get Thu Oct 18 10:05:56 UTC+0100 2012
in Firefox i get Thu Oct 18 2012 10:06:26 GMT+0100 (GMT Daylight Time)
Chrome is the same as firefox

I am using the following to get the value:

 var ImpDate = $("#dpimp").data("kendoDateTimePicker").value();

Why is this happening, it is causing me problems on my webservice as i am trying to convert the kendo date into a c# date by doing the following:

  ImpDate = ImpDate.Remove(24);
  DateTime dtImpDate = DateTime.ParseExact(ImpDate, "ddd MMM dd yyyy HH:mm:ss", CultureInfo.CurrentCulture);

And obviously with the IE format being different it fails.

2 Answers, 1 is accepted

Sort by
0
Accepted
Vladimir Iliev
Telerik team
answered on 22 Oct 2012, 12:58 PM
Hi Craig,


Basically the Value method of the DateTimePicker returns JavaScript Date object, which is formatted differently between IE and Firefox. To get the exact same Date format from all browsers you should format the Date before sending it to the controller for example using the toString method of KendoUI Framework:

//Returns date in the exact format from all browsers
kendo.toString($("#datetimepicker").data("kendoDateTimePicker").value(), "ddd MMM dd yyyy HH:mm:ss")

 Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Craig Broadhead
Top achievements
Rank 1
answered on 22 Oct 2012, 01:09 PM
That sorted it!

Thanks Vladimir.

Tags
Date/Time Pickers
Asked by
Craig Broadhead
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Craig Broadhead
Top achievements
Rank 1
Share this question
or