Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Trying to add an internal clock on my App but it's not refreshing the window to change the hours minutes and seconds

$
0
0

I tried placing all my code in a function thinking I will call the function on the text property inside a label but nothing shows up on the label however when I call the variable time on the text label it does display the time but everything stays static on the timelabel in order to see if the time change I have to close out the application and open it again then I can see the minute change I wanted to know how can make this work? I even used setTimeout and setInterval but it only closes the window out var nowDate = new Date(); var nowHour = nowDate.getHours(); var nowMinute = nowDate.getMinutes(); var nowSecond = nowDate.getSeconds(); var amOrPm = nowHour;

if(nowHour>'12'){
    amOrPm ='PM';
}else{
    amOrPm='AM';
};
if(nowMinute<'10'){
    nowMinute ='0'+nowMinute;
};

if(nowSecond<'10'){
    nowSecond='0'+nowSecond;
};

if(nowHour=='18'){
    nowHour='6';
}else if(nowHour =='19'){
    nowHour='7';
}else if(nowHour=='20'){
    nowHour='8';
}else if(nowHour=='21'){
    nowHour='9';
}else if(nowHour=='22'){
    nowHour='10';
}else if(nowHour=='23'){
    nowHour ='11';
}else if(nowHour=='00'){
    nowHour ='12';
        /////////////////////////////
}else if(nowHour=='13'){
    nowHour ='1';
}else if(nowHour=='14'){
    nowHour ='2';
}else if(nowHour=='15'){
    nowHour ='3';
}else if(nowHour=='16'){
    nowHour ='4';
}else if(nowHour=='17'){
    nowHour ='5';
}
var time = nowHour+':'+nowMinute+':'+nowSecond+''+''+''+amOrPm;

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>