﻿	

// JavaScript Documentfunction gettheDate() {

var timerID = null;
var timerRunning = false;
function showtime () {

    var currentTime = new Date()
    var month = currentTime.getMonth() + 1
    var day = currentTime.getDate()
    var year = currentTime.getFullYear()
    ///
	var now = new Date();
	var hours = currentTime.getHours();
	var minutes = currentTime.getMinutes();
	var seconds = currentTime.getSeconds();
	
	var timeValue = getVietNamesDayName(currentTime.getDay())+ " , Ngày " +day+"/"+month +"/"+year + " - "+ ((hours >12) ? hours -12 :hours);
	timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
	timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
	timeValue += (hours >= 12) ? " PM " : " AM ";
	
	var datetimeid=document.getElementById("divDateTime");
	datetimeid.innerHTML=timeValue;
}
function showtimeEngLish () {

    var currentTime = new Date()
    var month = currentTime.getMonth() + 1
    var day = currentTime.getDate()
    var year = currentTime.getFullYear()
    ///
	
	var hours = currentTime.getHours();
	var minutes = currentTime.getMinutes();
	var seconds = currentTime.getSeconds();
	var timeValue =currentTime.toLocaleDateString()+  " - " + ((hours >12) ? hours -12 :hours);
	timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
	timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
	timeValue += (hours >= 12) ? " P.M " : " A.M ";
	
	var datetimeid=document.getElementById("divDateTime");
	datetimeid.innerHTML=timeValue;
}
function getVietNamesDayName(num)
{
    var day=new Array("Chủ nhật","Thứ 2","Thứ 3","Thứ 4","Thứ 5","Thứ 6","Thứ 7");
    
    return day[num];
}
function getEngLishDayName(num)
{
    var day=new new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');    
    return day[num];
}			
					
   function GetDate(){
            setInterval("TimeUpdate()",1000);
        }
        function TimeUpdate(){
         
            if(lang =='vi-VN'){
                //$get('divDateTime').innerHTML = myDays[clientDate.getDay()] + ", Ngày " + day  + "/" + month + "/" + year + " " + clientDate.localeFormat("T");
                showtime ();
            }
            else
            {
                 //$get('divDateTime').innerHTML = day  + "/" + month + "/" + year + " " + clientDate.localeFormat("T");
                 showtimeEngLish ();
            }
        }
