Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

intervals

/* Place your JavaScript in this file */
let CLOCK_SECONDS = 0;
let CLOCK_MINUTES = 0;
let CLOCK_HOURS = 0;
let CLOCK_DAY = 0
let CLOCK_MONTH = 0;
let CLOCK_YEAR = 0;
setInterval(function (){
    let DATE_CLOCK = new Date()
    CLOCK_SECONDS = DATE_CLOCK.getSeconds();
    CLOCK_MINUTES = DATE_CLOCK.getMinutes();
    CLOCK_HOURS = DATE_CLOCK.getHours();
    CLOCK_YEAR = DATE_CLOCK.getFullYear();
    CLOCK_MONTH = DATE_CLOCK.getMonth()+1;
    CLOCK_DAY = DATE_CLOCK.getDate();

   
    document.getElementById("main").textContent = ("TIME:     " +check(CLOCK_HOURS)) + ":" +check(CLOCK_MINUTES) + ":"+check(CLOCK_SECONDS);
    document.getElementById("main2").textContent = ("DATE:    " + check(CLOCK_MONTH)) + "/" + check(CLOCK_DAY) + "/" + check(CLOCK_YEAR)
},1000)
function check(x){
    if (x < 10){
        return "0" + x.toString();
    }else {
        return x.toString()
    }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: date methods javascript 
Javascript :: javascript "use strict" 
Javascript :: javascript Octal syntax is not allowed 
Javascript :: electron InitializeSandbox() called with multiple threads in process gpu-process. 
Javascript :: JavaScript Iterables 
Javascript :: status role discord.js 
Javascript :: setup environment variables - fastify 
Javascript :: get max type value in solidity 
Javascript :: jquery if each checkbox is checked push array using each site:stackoverflow.com 
Javascript :: javascript get days difference between two dates 
Javascript :: cannot set headers after they are sent to the client mongoose 
Javascript :: javascript template string condtioning 
Javascript :: set rotation and origin phaser 
Javascript :: phaser place on circles 
Javascript :: phaser create animation from texture atlas 
Javascript :: Counting Duplicates 
Javascript :: toast plugin 
Javascript :: Datatable js Search Server side after time or word length 
Javascript :: docker for node , exoress and coackraz 
Javascript :: white space below image next image 
Javascript :: usestate access previous state 
Javascript :: ternary operators js 
Javascript :: brightness javascript 
Javascript :: react native icons 
Javascript :: how to remove react icon from tab 
Javascript :: Update an object as state with React hooks 
Javascript :: getDownload url in firebase 
Javascript :: Auto increment in firebase realtime database 
Javascript :: react native generate signed apk getting older version 
Javascript :: ilan mask 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =