Timepicker: Save in different format than parseFormat?

3 posts, 0 answers
  1. Alexander
    Alexander avatar
    19 posts
    Member since:
    Jun 2012

    Posted 02 Oct 2012 Link to this post

    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. Dennis
    Dennis avatar
    30 posts
    Member since:
    Aug 2012

    Posted 02 Oct 2012 Link to this post

    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
  3. Kendo UI is VS 2017 Ready
  4. Hugo
    Hugo avatar
    28 posts
    Member since:
    May 2011

    Posted 03 Jan 2013 Link to this post

    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()

Back to Top