﻿function Clock() {
	var date = new Date();
	this.year = date.getFullYear();
	//this.month = date.getMonth() + 1;
	this.month=new Array("January","February","March","April","May","June","July","August","September","October","November","December")[date.getMonth()];
	this.date = date.getDate();
	this.day = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")[date.getDay()];
	this.hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
	this.minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
	this.second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
   /* var month="";
	switch(i)
	{
      case:1
		 month="Jur.";break;

	  case:2
		 month="Feb.";break;
	  case:3
		 month="Mar.";break;
	  case:4
		 month="Apr.";break;
	  case:5
		 month="May.";break;
	  case:6
		 month="Jue.";break;
	  case:7
		 month="Jul.";break;
	  case:8
		 month="Aug.";break;
	  case:9
		 month="Sept.";break;
	  case:10
		 month="Oct.";break;
      case:11
		 month="Dec.";break;
	  case:12
		 month="Nov.";break;
	  default:
		  break;
	 
	}*/
	
	this.toString = function() {
		return "现在是:" + this.year + "年" + this.month + "月" + this.date + "日 " + this.hour + ":" + this.minute + ":" + this.second + " " + this.day; 
	};

	this.toSimpleString = function() {
		//return  this.year + "年" + this.month + "月" + this.date + "日  " + this.day; 
		return this.day +" "+ this.date +" " + this.month +" "+this.year;
	};
	
	this.toSimpleDate = function() {
		return this.year + "-" + this.month + "-" + this.date;
	};
	
	this.toDetailDate = function() {
		return this.year + "-" + this.month + "-" + this.date + " " + this.hour + ":" + this.minute + ":" + this.second;
	};
	
	this.display = function(ele) {
		var clock = new Clock();
		ele.innerHTML = clock.toSimpleString();
		window.setTimeout(function() {clock.display(ele);}, 1000);
	};
}
