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

Date Picker

3 Answers 133 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 16 Jul 2013, 02:56 PM
Hello,

I am having trouble with rendering a DatePicker.  When I use test data with a date format of 07/18/2013 the datepicker renders correctly.  When I get data from a web service call from a MySQL database the format is 2013-07-18 00:00:00 when retrieved using a SQL statement from phpMyadmin.  The date returned from as JSON is formatted as a JSON date /Date(1374120000000-0400)\.  When I use the JSON date the DatePicker does not render and instead shows a date Thu Jul 18 2013 00:00:00 GMT-0400 (Eastern Daylight Time).  What step(s) am I missing that will allow me to correctly render the DatePicker with the JSON formatted date?

Scott

3 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 16 Jul 2013, 03:12 PM
Hi Scott,

The Kendo UI DatePicker will only accept a valid JavaScript date object. This is why I would suggest you to parse the JSON date, which is using the Timestamp format (milliseconds since january 1 1970), into a JavaScript date object using new Date() and then pass this object to the DatePicker.

For your convenience here is a jsBin example which demonstrates a possible implementation.
 
Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Scott
Top achievements
Rank 1
answered on 16 Jul 2013, 03:38 PM
Kiril,

Thank you for your quick response.
0
Kiril Nikolov
Telerik team
answered on 16 Jul 2013, 06:04 PM
Hello Scott,

I am glad I helped.

If you need anything else, do not hesitate to contact us.
 
Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Date/Time Pickers
Asked by
Scott
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Scott
Top achievements
Rank 1
Share this question
or