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

Sending dates to server as yyyy-MM-dd

1 Answer 88 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Alan Mosley
Top achievements
Rank 1
Alan Mosley asked on 19 Jan 2015, 05:00 PM
Using date pickers I need to format as dd-MM-yyyy, but when posting to server I need to post as yyyy-MM-dd
using ajax I can do this using "FromDate": kendo.toString($("#FromDate").data("kendoDatePicker").value(), "yyyy/MM/dd")

but when using the MVC wrappers in a form how can I send to server as yyy-MM-dd?

Thnaks

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 21 Jan 2015, 01:49 PM
Hello Alan,

If you are posting the value to the server using regular Html form element, it is not possible to change format of the value without manual input value update on form submit. In other words, you will need to wire the submit event of the form and modify the value using the desired format. In general, this is not related to Kendo UI, but more to the way how the successful controls work in Html.

If you are posting the values using Ajax, you can update posted value before sending it to the server, as you mentioned in your message. Again the change should be done manually.

The third possible way to support such value format differences is to use custom ModelBinder that will know how to parse date strings with different formats.

Regards,
Georgi Krustev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Date/Time Pickers
Asked by
Alan Mosley
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or