Clock App
This sample application is reprinting of Think IT article released on 3/11/2013.
This sample app is a clock app displaying current Date and time.
Demo
Import Clock App to your Monaca Account
Tested Environment
Android 11.0
iOS 14.3
File Components
File | Description |
| The Startup page |
| The JavaScript file handling implementation in the project |
| The style Sheet for the project |
| All image files needed to use this template |
HTML Explanation
index.html
The following HTML body of index.html
file is for displaying the current Date and time.
JavaScript Explanation
js/app.js
When the application is loaded, the clock()
function is called every 1 seconds (1000 ms
) by this statement:
The clock()
function is used to display the current date and time. First, it gets the current time (hour, minute and second) and then display the images (digit image) according to the time. Next, it gets the current date (day, month and year) and then display it in the format as defined in renderDay()
and renderMonth()
functions. Here is content of the clock()
function:
Last updated