javascript 时间加减 分钟

	 var mintime=new Date(); 
		  var minyear=mintime.getFullYear(); 
		  var mindate=mintime.getDate(); 
		  var minhour=mintime.getHours(); 
		  var minmonth=mintime.getMonth()+1;
		  var minmin=0;
		  var mintimstr=minyear+"-"+minmonth+"-"+mindate+" "+minhour+":00:00";
		   $("#minutetimeval").val(mintimstr);
		   $("#label7btnshour").click(function(){ 
		       var minutevaluetype=$('input[name="minutevaluetype"]:checked').val();
		       var minutetimeval=$("#minutetimeval").val();	
		       var date=new Date(minutetimeval);		       	       
				var t = date.getTime();
				t -= minutevaluetype*60*1000;//秒
				date.setTime(t);				
		       var mintime1=date; 
		       var minyear1=mintime1.getFullYear(); 
		       var mindate1=mintime1.getDate(); 
		       var minhour1=mintime1.getHours(); 
		       var minmonth1=mintime1.getMonth()+1;
		       var minutes1=mintime1.getMinutes();
		       if(minutes1=="0")
		       {
		          minutes1="00";
		       }
		       var mintimstr1=minyear1+"-"+minmonth1+"-"+mindate1+" "+minhour1+":"+minutes1+":00";
			   $("#minutetimeval").val(mintimstr1);
			}); 
		    $("#label7btnxhour").click(function(){ 
			    var minutevaluetype=$('input[name="minutevaluetype"]:checked').val();
		       var minutetimeval=$("#minutetimeval").val();	
		       var date=new Date(minutetimeval);		       	       
				var t = date.getTime();
				t += minutevaluetype*60*1000;//秒
				date.setTime(t);				
		       var mintime1=date; 
		       var minyear1=mintime1.getFullYear(); 
		       var mindate1=mintime1.getDate(); 
		       var minhour1=mintime1.getHours(); 
		       var minmonth1=mintime1.getMonth()+1;
		       var minutes1=mintime1.getMinutes();
		       if(minutes1=="0")
		       {
		          minutes1="00";
		       }
		       var mintimstr1=minyear1+"-"+minmonth1+"-"+mindate1+" "+minhour1+":"+minutes1+":00";
			   $("#minutetimeval").val(mintimstr1);
			}); 

你可能感兴趣的:(javascript 时间加减 分钟)