Round time to hour
-
Hi,
I have time in textField like below:tf6.text = new Date(elapsed).toLocaleTimeString(Qt.locale(), "hh" + ":" + "mm")
When in this text field I have time > 2:15, I would liketo get integer 3.. How to this ?
-
Hi,
I have time in textField like below:tf6.text = new Date(elapsed).toLocaleTimeString(Qt.locale(), "hh" + ":" + "mm")
When in this text field I have time > 2:15, I would liketo get integer 3.. How to this ?
@Damian7546
Do the rounding on theDate
JS Date Object not on the string produced from it. -
You can check if the minutes are bigger than X and just set hour and minutes
hour = date.getHours() minute = date.getMinutes() if(minute > 0){ date.setMinutes(0) date.setHours(hour+1) }