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.
-
JanMolendijk
- 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
<SCRIPT LANGUAGE="JavaScript">
day = new Date()
hr = day.getHours()
mn = day.getMinutes()
se = day.getSeconds()
</SCRIPT>
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?")
MarPlo
See and use the following example:
Code: Select all
<script>
var day = new Date();
let hr = day.getHours();
let mn = day.getMinutes();
let se = day.getSeconds();
let st_hm ='Hour: '+hr+', minutes: '+mn;
document.write(st_hm);
</script>
Similar Topics
-
Dot product of two arrays in Javascript
JavaScript - jQuery - Ajax
First post
What's an efficient way of implementing the dotProduct method (to get the Dot product of two arrays) without importing any new Javascript libraries?...
Last post
Here is a method.
Use the map() function to create a new array with multiplied results of each index and the reduce() function to sum the values of...
-
Problem with 'this' in function.call() in JavaScript
JavaScript - jQuery - Ajax
First post
Why the function.call() behaves differently with and without ' this ', in JavaScript?
The result with 'this' in test.call() is same when 'this' is...
Last post
The call() function require the first parameter as 'this' object, if you do not need it, just pass null .
test.call(null, ...args);
In your...
-
Display message to every minute in Javascript
JavaScript - jQuery - Ajax
First post
Hello,
On eatch minute from the current hour I wanna have an message
I can not find out how to complete
I hope to get something like this (code...
Last post
If you only want to display a message to every minute, just use the setInterval() function. It calls a function repeatedly, over and over again, at...
-
Convert 8-bit integer to Hex color value in JavaScript
JavaScript - jQuery - Ajax
First post
I'm trying to convert 8-bit integer to Hex color value. (e.g. FFFFFF)
The 8-bit color integer is generated with the following formula:
color =...
Last post
If you have an integer you can do with:
color.toString(16)
And it will turn it in to a hex string.
// White
color = (255 * 65536) + (255 *...
-
Handle apostrophe in input value with JavaScript
JavaScript - jQuery - Ajax
First post
I have a JavaScript code that adds an input field for a user:
var user = O'Conner, John ;
b.innerHTML += <input type='hidden' value=' + user +...
Last post
You can replace the character with its HTML entity.
As for ' - It can either be ’ or ‘
var user = O'Conner, John ;
user =...