Hour and Minutes togheter in Javascript

Topics related to client-side programming language.
Post questions and answers about JavaScript, Ajax, or jQuery codes and scripts.
User avatar
Posts: 282
Location: Holland Rotterdam

Hour and Minutes togheter in Javascript

Dear Coursesweb I can not find out how to add the hours + minutes togheter.

Code: Select all

day = new Date() 
hr = day.getHours() 
mn = day.getMinutes() 
se = day.getSeconds() 


I would like to have both in one ???? hr + mn ????

Code: Select all

hr = day.getHours() 
mn = day.getMinutes() 

miho = hr,mn ?????????????????????

This is the exmple what is working seperated

Code: Select all

if (hr == 1) document.write("Het is na enen. nog niet naar bed?") 

if (se == 1) document.write("<br>1  Wat gaat er gebeuren ?") 
if (mn == 52) document.write("Na22222zessen. De afwas al gedaan?") 

See and use the following example:

Code: Select all

var day = new Date();
let hr = day.getHours();
let mn = day.getMinutes();
let se = day.getSeconds();

let st_hm ='Hour: '+hr+', minutes: '+mn;

Similar Topics