window.onload = Watch;
var Today = new Date('<?= Yii::$app->user->getUserJsDateTime() ?>');
function Watch(){
Hour = Today.getHours() ;
Minits = Today.getMinutes() ;
Seconds = Today.getSeconds() ;
if (Hour<=9) Hour = '0' + Hour ;
if (Minits<=9) Minits = '0' + Minits ;
if (Seconds<=9) Seconds = '0' + Seconds ;
if (Hour >= 12) {
Time = ' PM';
}
else {
Time = ' AM';
}
HourProc=Hour;
if (Hour==13) HourProc = '1';
if (Hour==14) HourProc = '2';
if (Hour==15) HourProc = '3';
if (Hour==16) HourProc = '4';
if (Hour==17) HourProc = '5';
if (Hour==18) HourProc = '6';
if (Hour==19) HourProc = '7';
if (Hour==20) HourProc = '8';
if (Hour==21) HourProc = '9';
if (Hour==22) HourProc ='10';
if (Hour==23) HourProc = '11';
if (Hour==24) HourProc = '12';
if (Hour==0) HourProc = '12';
var Day = new Array(
'" . Yii::t('backend', 'Sunday') . "',
'" . Yii::t('backend', 'Monday') . "',
'" . Yii::t('backend', 'Tuesday') . "',
'" . Yii::t('backend', 'Wednesday') . "',
'" . Yii::t('backend', 'Thursday') . "',
'" . Yii::t('backend', 'Friday') . "',
'" . Yii::t('backend', 'Saturday') . "',
'" . Yii::t('backend', 'Sunday') . "'
);
var Month = new Array(
'" . Yii::t('backend', 'January') . "',
'" . Yii::t('backend', 'February') . "',
'" . Yii::t('backend', 'March') . "',
'" . Yii::t('backend', 'April') . "',
'" . Yii::t('backend', 'May') . "',
'" . Yii::t('backend', 'June') . "',
'" . Yii::t('backend', 'July') . "',
'" . Yii::t('backend', 'August') . "',
'" . Yii::t('backend', 'September') . "',
'" . Yii::t('backend', 'October') . "',
'" . Yii::t('backend', 'November') . "',
'" . Yii::t('backend', 'December') . "');
var Year = Today.getFullYear();
var theDate = ' ' +Day[Today.getDay()] + ' ' + Today.getDate() + ', ' + Month[Today.getMonth()] + ' ' + Year;
var Ini, Script, Final, Total ;
Initis = '' ;
WatchString = HourProc + ':' + Minits + ':' + Seconds + Time + theDate ;
Ends = '' ;
TotalString = Initis + WatchString + Ends ;
document.getElementById('watch').innerHTML = TotalString ;
Today.setSeconds(Today.getSeconds() +1);
setTimeout('Watch()',1000) ;
}