Skip to content

Simple digital clock displaying hours, minutes, seconds, and AM/PM using HTML, CSS, and JavaScript.

Notifications You must be signed in to change notification settings

Jdecho1118/BasicClock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

README

Description: This JavaScript code provides functionality to create a simple digital clock display. It updates the current time every second and displays it in hours, minutes, seconds, and AM/PM format. The clock is displayed in a designated HTML element with the id 'clock'.

Usage:

  1. Ensure you have an HTML file containing an element with the id 'clock' where you want the clock to be displayed. For example:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Digital Clock</title>
    </head>
    <body>
        <div id="clock"></div>
        <script src="clock.js"></script>
    </body>
    </html>

    Save this file as index.html.

  2. Copy the provided JavaScript code into a file named clock.js.

  3. Place the clock.js file in the same directory as your index.html.

  4. Open the index.html file in a web browser.

  5. You should see the digital clock displayed in the clock div, updating every second.

Modification:

  • If you want to modify the appearance or behavior of the clock, you can edit the updateClock() function in the clock.js file. You can customize the format of the time display, adjust the interval of updating the clock, or add additional features as per your requirements.

License: This code is provided under the MIT License. Feel free to modify and use it according to your needs.

About

Simple digital clock displaying hours, minutes, seconds, and AM/PM using HTML, CSS, and JavaScript.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published