Adding a Clock Visualization to Your Dashboard (Video Tip)

Sometimes dashboards are built to go up on big-screen TVs or are constantly on the screen due to their real-time nature. In these real-time cases, you might consider putting a clock on your dashboard. Here’s how!

Here is the code I used:

// UPDATE THE DATE
var date = new Date();
var min = date.getMinutes();
if (min < 10)
{
	min = '0' + date.getMinutes();  
}
else 
{
	min = date.getMinutes();  
}
var sec = date.getSeconds();
if (sec < 10)
{
	sec = '0' + date.getSeconds();  
}
else 
{
	sec = date.getSeconds();  
}
var displayDate = (date.getMonth()+1) + '/' + date.getDate() + '/' + date.getFullYear() + '  ' + date.getHours() + ':' + min + ':' + sec; 
clockLabel.labelText = displayDate;

If you’d like to learn more, I’d recommend you go to my learning channel - Off the Charts (with Jeff).
https://www.dundas.com/resources/off-the-charts-tips-from-an-expert

2 Likes