Search
 
SCRIPT & CODE EXAMPLE
 

HTML

auto update time in html

timer();

function timer(){
 var currentTime = new Date()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
var sec = currentTime.getSeconds()
if (minutes < 10){
    minutes = "0" + minutes
}
if (sec < 10){
    sec = "0" + sec
}
var t_str = hours + ":" + minutes + ":" + sec + " ";
if(hours > 11){
    t_str += "PM";
} else {
   t_str += "AM";
}
 document.getElementById('time_span').innerHTML = t_str;
 setTimeout(timer,1000);
}
Comment

PREVIOUS NEXT
Code Example
Html :: hr tag html 
Html :: watermark in html5 
Html :: less css 
Html :: bootstrap css 
Html :: unordered list html 
Html :: html script crossorigin 
Html :: ionic phone url 
Html :: meta description tag in html 
Html :: html to text npm 
Html :: html if else statement example 
Html :: english to spanish 
Html :: jquery loop print html() 
Html :: HTML5 Video tag not working in Safari , iPhone and iPad 
Html :: connect html to mysql database 
Html :: text -center bootstrap 
Html :: html italic 
Html :: react render 
Html :: html make text bold 
Html :: change the font-size on a label css 
Html :: color selector html 
Html :: game code in html 
Html :: html contenteditable attribute 
Html :: instagram icon 
Html :: HTML Table - Rowspan 
Html :: ionic disable input field 
Html :: Hyperlink to text simple html a tag 
Html :: what is the PERN stack 
Html :: html ecrire en gras 
Html :: Bootstrap Text Colors Example 
Html :: HTML <sup 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =