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

How to get time from kendoDateTimePicker?

1 Answer 1413 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Tayger
Top achievements
Rank 1
Iron
Tayger asked on 30 Nov 2016, 08:57 PM

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

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 02 Dec 2016, 08:13 AM
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.
Tags
Date/Time Pickers
Asked by
Tayger
Top achievements
Rank 1
Iron
Answers by
Kiril Nikolov
Telerik team
Share this question
or