I'm using a Kendo DateTimePicker in my application.
The value I get from it in my application is
Wed Aug 13 2014 00:00:00 GMT+0200 (Romance Daylight Time)
I can't parse this to a DateTime. I get a "String was not recognized as a valid DateTime." error.
How can I set the format of the date I get from the DateTimePicker?? Is there an option in Kendo DateTimePicker??t
You can control the format of the DatePicker by using the format property. The component can be configured either to display a single format at all times, or to display the value in different formats when the input is focused or blurred.
Setting the Default Value To set the initial value that is rendered by the DatePicker, set the defaultValue property.
By default, the date format of the jQuery UI Datepicker is the US format mm/dd/yy, but we can set it to a custom display format, eg: for European dates dd-mm-yyyy and so on. The solution is to use the date picker dateFormat option.
The Kendo UI for Angular DatePicker combines the Kendo UI DateInput and Calendar components. It enables the user to enter or pick a date value. The DatePicker Component is part of Kendo UI for Angular, a professional grade UI library with 100+ components for building modern and feature-rich applications.
If you Need to Change the Date that you get from your application you can do as below
var dateobj=kendo.parseDate("Wed Aug 13 2014 00:00:00 GMT+0200 (Romance Daylight Time)", "yyyy-MM-dd h:mm:ss tt");
var datestring = kendo.toString(dateobj, "MM-dd-yyyy h:mm:ss tt");
kendo.parseDate()
will Parse the Date to a Date Object and kendo.toString()
will format the date to a string
If you need to convert the date you get from the Datepicker Do this
var datepicker = $("#datepicker").data("kendoDatePicker");
var value = datepicker.value();
kendo.toString(value,"dd/MM/YYYY")
IF you need to convert Datepicker date to the Sever Date
var datepicker = $("#datepicker").data("kendoDatePicker");
var value = datepicker.value();
value.toUTCString();
Here what I have used:
var dateobj = kendo.parseDate("Wed Aug 13 2014 00:00:00 GMT+0200 (Romance Daylight Time)");
var datestring = kendo.toString(dateobj, "MM-dd-yyyy h:mm:ss tt");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With