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

Timepicker: Save in different format than parseFormat?

2 Answers 282 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 02 Oct 2012, 03:43 PM
Hi, in our project our server expects time values to be a string in 24-hour format (HH:mm). However we want to use timepickers that display 12-hour format with AM/PM to the end user. Right now I am using

$('.timePicker').kendoTimePicker({
  parseFormats: ["HH:mm"]
});

and this works fine in terms of displaying the correct value from the database. However the problem is that the value of the field is saving back out to 12-hour format instead of 24. What can I do to display 12-hour format but save 24-hour?

2 Answers, 1 is accepted

Sort by
0
Dennis
Top achievements
Rank 1
answered on 02 Oct 2012, 04:16 PM
The exact same problem occured to me just now, I don't know if there is a more elegent way to solve the problem (there should be!) but I'm just gonna format it inside the paramterMap
0
Hugo
Top achievements
Rank 1
answered on 03 Jan 2013, 10:49 AM
To have a 24h clock you have to put "HH":

$("#hour").kendoTimePicker(
{
       format: "HH:mm",
       parseFormats: ["HH:mm"]
});
and then to get the value, you can use normal jQuery:
$("#hour").val()

Tags
Date/Time Pickers
Asked by
Alexander
Top achievements
Rank 1
Answers by
Dennis
Top achievements
Rank 1
Hugo
Top achievements
Rank 1
Share this question
or