How to add to the date 15 minutes? I try this way, but it does not work
let date = new Date(); let h = date.getHours(), m = date.setMinutes(date.getMinutes() + 15), res = h + ':' + m; $('.you-loan .js-loan').html(' ' + res); How to add to the date 15 minutes? I try this way, but it does not work
let date = new Date(); let h = date.getHours(), m = date.setMinutes(date.getMinutes() + 15), res = h + ':' + m; $('.you-loan .js-loan').html(' ' + res); This is how it works:
var CurrentTime = new Date(); CurrentTime.setMinutes(CurrentTime.getMinutes() + 15); console.log(CurrentTime.getHours()+":"+CurrentTime.getMinutes()); In addition, it is important that getHours and getMinutes are called after changing the date - and not before.
Source: https://ru.stackoverflow.com/questions/604215/
All Articles
handmthat you output. Yes, and in the documentation something is not visible thatsetMinutesreturns something. - teran