Search
 
SCRIPT & CODE EXAMPLE
 

HTML

add time bar to website complete code

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>JavaScript Dates</title>
</head>
<style>
    .container {
        font-size: 23px;
        background-color: blanchedalmond;
        border: 2px solid grey;
        padding: 34px;
        margin: 4px;
        text-align: center;
    }

    #time {
        font-weight: bold;
    }
</style>

<body>
    <div class="container">
        Current time is <span id="time"></span>
    </div>
    <script>
        console.log("This is date and time tutorial");
        let now = new Date();
        console.log(now);

        let dt = new Date(1000);
        console.log(dt);

        // let newDate = new Date("2029-09-30");
        // console.log(newDate)

        // let newDate = new Date(year, month, date, hours, minutes, seconds, milliseconds);
        let newDate = new Date(3020, 4, 6, 9, 3, 2, 34);
        console.log(newDate);

        let yr = newDate.getFullYear();
        console.log("The year is ", yr);

        let dat = newDate.getDate();
        console.log("The date is ", dat);

        let month = newDate.getMonth();
        console.log("The month is ", month);

        let hours = newDate.getHours();
        console.log("The hours is ", hours);

        newDate.setDate(8);
        newDate.setMinutes(29);
        console.log(newDate)
        setInterval(updateTime, 1000);

        function updateTime() {
            time.innerHTML = new Date();
        }

    </script>
</body>

</html>
Comment

PREVIOUS NEXT
Code Example
Html :: js lib alert 
Html :: easyui how to make panel collapsible 
Html :: Using the id attribute 
Html :: rmarkdown revealjs_presentation remove black border to images 
Html :: how to see to coordinate of an html element s chrome debugger 
Html :: boostrap date input withour day 
Html :: Form INPUT Determine multiple file extensions 
Html :: plantuml bold text 
Html :: imutils video stream external camera 
Html :: 2 button component in single row vuetify 
Html :: typo3 params lost pagination 
Html :: my-md-1 
Html :: store json object in data attribute in html 
Html :: paragraphe en html 
Html :: overlay text input html 
Html :: Laravel get the data and display it in the blade html failed 
Html :: telerik radgrid export to excel keep leading zeros 
Html :: input tag avoid to type 
Html :: html5 vs css3 
Html :: How To Create "Empty" <Label Tag Without Name 
Html :: html programming language 
Html :: html insert html snippets 
Html :: webview html 
Html :: construindo html amp 
Html :: selecting only one radio button 
Html :: how to run yaml file 
Html :: onclick call php function with parameters 
Css :: how to center div with transform 
Css :: css all caps 
Css :: text align left top 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =