A stylish, interactive digital clock web application with dynamic theme switching and time format options.
- Real-time Clock Display: Shows current time with hours, minutes, and seconds updated every second
- 12/24 Hour Format Toggle: Switch between 12-hour (AM/PM) and 24-hour time formats
- Day/Night Theme: Automatic theme switching based on time of day (6 AM - 6 PM is day, otherwise night)
- Manual Theme Override: Toggle between day and night themes manually with the dedicated button
- Current Date Display: Shows the full date in a readable format (e.g., "Monday, 25 January 2026")
- Responsive Design: Centered layout that works across different screen sizes
- Smooth Transitions: Elegant CSS transitions for theme and color changes
- Open the Application: Open
index.htmlin a web browser - View the Clock: The current time and date will display automatically
- Toggle Time Format: Click the "12/24 Hour" button to switch between 12-hour and 24-hour formats
- Toggle Theme: Click the "Day/Night" button to manually switch between light and dark themes
Digital Clock/
├── index.html # HTML structure and layout
├── script.js # JavaScript functionality and logic
├── styles.css # Styling and theme definitions
└── README.md # This file
- HTML5: Semantic structure and layout
- CSS3: Styling, flexbox layout, and smooth transitions
- JavaScript (Vanilla): Real-time clock updates, theme management, and format toggling
- Light background with readable dark text
- Time boxes styled in light gray (#f5f5f5) with red text (#c1121f)
- Red buttons with white text
- Dark background (black) for eye comfort
- Time boxes with dark gray background (#1c1c1e) and white text
- White buttons with black text
is24HourFormat: Tracks the current time format settingmanualThemeToggle: Tracks whether the user has manually overridden the automatic theme
updateClock(): Updates the time, date, and applies automatic theme based on time of daytoggleFormat(): Switches between 12-hour and 24-hour time formatstoggleTheme(): Manually toggles between day and night themes
- Add timezone selection
- Add customizable themes and colors
- Add local storage to remember user preferences
- Add digital/analog clock view toggle
- Add alarm functionality
- Add sound effects for theme transitions
Works in all modern browsers that support:
- ES6 JavaScript
- CSS Flexbox
- CSS Transitions