How to get time from kendoDateTimePicker?

2 posts, 0 answers
  1. Tayger
    Tayger avatar
    71 posts
    Member since:
    Jan 2015

    Posted 30 Nov 2016 Link to this post

    Hello 

    Just working with kendoDateTimePicker... I have a startdate and an enddate, both working wit DateTimePicker. After entering both I have to evaluate if endtime is bigger than starttime. I'm able to get year, month and day by: 

    startDate.getFullYear()
    startDate.getMonth()
    startDate.getDay()

    That works fine even if month (getMonth()) comes back with a month number 1 lower than expected. Example:

    January: 0 (expected: 1)
    December: 11 (expected: 12)

    It looks like that these functions starts counting the months of the year by 0 and not by 1, maybe thats wanted.

    Furthermore I don't know if I can get these values (month, day) back with two digits: "01" instead of "1"? I can handle that also in Javascript, just additional work.

    So the main question is: How can I get time out of kendoDateTimePicker (hours and minutes)? I couldn't find functions like getHour() or getMinute(). In hope it would somehow helps I have added: parseFormats: ["MMMM yyyy", "HH:mm"]

    Regards

  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2598 posts

    Posted 02 Dec 2016 Link to this post

    Hi,

    The TimePicker widget works with valid JavaScript dates, so you can get just the time using this approach:

    http://stackoverflow.com/questions/15546292/extract-time-from-datetime-using-javascript

    Regards,
    Kiril Nikolov
    Telerik by Progress
    Kendo UI is ready for Visual Studio 2017 RC! Learn more.
Back to Top