setHours

Returns a new date object with replaced time part from another date object.

Parameters

targetDate Date

The date object to replace the time part of.

sourceDate Number

The date object that will be used for obtaining the time part.

Returns

Date Returns a new date object with a replaced time part from another date object.

Example

<script>
    var targetDate = new Date(2016,10,5,15,25,11);
    var sourceDateWithTime = new Date(2016,10,15,17,27,17);
    var dateWithNewTime = kendo.date.setHours(targetDate, sourceDateWithTime);
/* The result can be observed in the DevTools(F12) console of the browser. */
    console.log(dateWithNewTime); // Sat Nov 05 2016 17:27:17 GMT+0200 (FLE Standard Time)
</script>
In this article