//Called when application is started. function OnStart() { //Create a layout with objects vertically centered. lay = app.CreateLayout( "linear", "VCenter,FillXY" ); lay.SetBackColor("#ff665578") //Create a text label and add it to layout. txtd = app.CreateText( "Digital Clock" ); txtd.SetTextSize( 45 ); txtd.SetMargins(0,0,0,0.03) lay.AddChild( txtd ); //Create Text text = app.CreateText( "" ); text.SetTextSize( 25 ); text.SetTextColor("#ff879964") lay.AddChild( text ); //Create a text label and add it to layout. txt = app.CreateText( "" ); txt.SetTextSize( 32 ); lay.AddChild( txt ); //Add layout to app. app.AddLayout( lay ); setInterval(Clock,1000) } function Clock() { var day =["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"] var today = new Date(); var y = today.getFullYear() var h = today.getHours(); var m = today.getMinutes(); var s = today.getSeconds(); var mi = today.getMilliseconds(); var mon =today.getMonth() var d = today.getDay() var mon = today.getMonth()+1 var dt = today.getDate() text.SetText(day[d]+" "+dt+"/"+mon+"/"+y) if(s<10&&m<10&&h<10){ txt.SetText("0"+h+":"+"0"+m+":"+"0"+s) } else{ if(s<10&&h<10){ txt.SetText("0"+h+":"+m+":"+"0"+s) } else if(h<10&&m<10){ txt.SetText("0"+h+":"+"0"+m+":"+s) } else if(m<10&&s<10){ txt.SetText(h+":"+"0"+m+":"+"0"+s) } else{ if(h<10){ txt.SetText("0"+h+":"+m+":"+s) } else if(m<10){ txt.SetText(h+":"+"0"+m+":"+s) } else if(s<10){ txt.SetText(h+":"+m+":"+"0"+s) } else{ txt.SetText(h+":"+m+":"+s) } } } }