/**
 * 
 */

var helper={};

	
	helper.formatTime=function(time){
		var t=new Date(time);
		var y=t.getFullYear();
		var m=t.getMonth()+1;
			m=(m<10)?"0"+m:m;
		var d=t.getDate();
			d=(d<10)?"0"+d:d;
		var h=t.getHours();
			h=(h<10)?"0"+h:h;
			return y+"-"+m+"-"+d+" "+h+":"+"00:00";
	};
	
	

	helper.nextTime=function(str){
		tmp=[];
		console.log(str)
		var ts=str.split("-");
			ts.forEach(function(s){
				tmp.push(parseInt(s));
			});
		var time=new Date(tmp[0],tmp[1]-1,tmp[2],(tmp[3]-1),0,0);
			
			return this.formatTime(time.getTime());
	};
	
	
	helper.getTime=function(str){
		tmp=[];
		var ts=str.split("-");
			ts.forEach(function(s){
				tmp.push(parseInt(s));
			});
		var time=new Date(tmp[0],tmp[1]-1,tmp[2],tmp[3],0,0);
			
			return this.formatTime(time.getTime());
	};
	
	
	helper.getTimeStamp=function(str){
		tmp=[];
		str=str.replace(" ","-");
		var ts=str.split("-");
			ts.forEach(function(s){
				tmp.push(parseInt(s));
			});
		var time=new Date(tmp[0],tmp[1]-1,tmp[2],tmp[3],0,0);
		
		return time.getTime();
	}
	
	
	helper.getFulltimePoint=function(str){
		var tmp=[];
			str=str.replace(" ","-");
			str=str.replace(/:/g,"-");
			ts=str.split("-");
			ts.forEach(function(s){
				tmp.push(parseInt(s));
			});
			
			var time=new Date(tmp[0],tmp[1]-1,tmp[2],tmp[3],tmp[4],tmp[5]);
				console.log(tmp,time)
			var h=time.getHours();
			if(h==0){		
				var time=new Date(time.getTime()-60*60*1000);
				var y=time.getFullYear();
				var m=time.getMonth()+1;
					m=(m<10)?"0"+m:m;
				var d=time.getDate();
					d=(d<10)?"0"+d:d;
				var h=time.getHours();
					return y+"-"+m+"-"+d+" "+h+"点至24点";
				
			}else if(h==8){
				var time=new Date(time.getTime()-12*60*60*1000);
				var y=time.getFullYear();
				var m=time.getMonth()+1;
					m=(m<10)?"0"+m:m;
				var d=time.getDate();
					d=(d<10)?"0"+d:d;
				var h=time.getHours();
					return y+"-"+m+"-"+d+" "+h+"点至" +y+"-"+m+"-"+(d+1)+' 8点'
			}else{		
				var y=time.getFullYear();
				var m=time.getMonth()+1;
					m=(m<10)?"0"+m:m;
				var d=time.getDate();
					d=(d<10)?"0"+d:d;
				var h=time.getHours();
					//h=(h<10)?"0"+h:h;
					return y+"-"+m+"-"+d+" "+(h-4)+"点至"+h+"点";	

			}
		
	};
	

	helper.getPoint=function(str){
		tmp=[];
		str=str.replace(" ","-");
		var ts=str.split("-");
			ts.forEach(function(s){
				tmp.push(parseInt(s));
			});
		var time=new Date(tmp[0],tmp[1]-1,tmp[2],tmp[3],0,0);
		
		
			var h=time.getHours();
			if(h==0){
				
				var time=new Date(time.getTime()-60*60*1000);
				
				var y=time.getFullYear();
				var m=time.getMonth()+1;
					m=(m<10)?"0"+m:m;
				var d=time.getDate();
					d=(d<10)?"0"+d:d;
				var h=time.getHours();
					return y+"-"+m+"-"+d+" "+h+"点至24点";
				
			}else{
					
				var y=time.getFullYear();
				var m=time.getMonth()+1;
					m=(m<10)?"0"+m:m;
				var d=time.getDate();
					d=(d<10)?"0"+d:d;
				var h=time.getHours();
					//h=(h<10)?"0"+h:h;
					return y+"-"+m+"-"+d+" "+(h-1)+"点至"+h+"点";	
			}
			
	};
	


	



	