Forum Discussion
Submit Result Trigger at a Specific Daily Time
Try this.
var myVar = setInterval(myTimer, 1000);
var flag = true;
function myTimer() {
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
var hour = currentTime.getHours();
var minute = currentTime.getMinutes();
hour = String(hour);
minute = String(minute);
var timeString= hour +minute ;
if (timeString>="1130"|| timeString >= 1130 && flag== true){
flag = false;
myStopFunction();
var player = GetPlayer();
player.SetVar("SystemTime",timeString);
}
}
function myStopFunction() {
clearInterval(myVar);
}
Hi Raj,
Thank you so much for your fantastic support. It's WORKED now. And this is the latest code I used.
PS: the only thing issue is that it is called the system time so when the user changed the device time, they still manage to do the test.
var myVar = setInterval(myTimer, 1000);
var flag = true;
function myTimer() {
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
var hour = currentTime.getHours();
var minute = currentTime.getMinutes();
hour = String(hour);
minute = String(minute);
var timeString = hour + minute;
timeString = Number(timeString);
var timeNumber = timeString;
if (timeNumber >= 1310 || timeNumber>= 1200 && flag == true){
flag = false;
myStopFunction();
var player = GetPlayer();
player.SetVar("SystemTime",timeNumber);
}
}
function myStopFunction() {
clearInterval(myVar);
}Related Content
- 6 months ago
- 10 years ago