function time(year,month,day,hour,min,s){
days=0//天数
days+=year*365//年化天
days+=(month-1)*30//1月,月化天
days+=day//天化天
the_year=year-1//记录年数,作备用,进行闰年计算
//判断当前年是否计入计算
if(month>2||(month==2&&days==29)){
the_year+=1
}
//闰年判定
for(year_for=0;year_for<the_year+1;year_for++){
if(year_for%400==0||(year_for%4==0&&year_for%100!=0)){
days+=1
}
}
//月31日判定
if(month==12||month==11){
days+=6
}else if(month==10||month==9){
days+=5
}else if(month==8){
days+=4
}else if(month==7||month==6){
days+=3
}else if(month==5||month==4){
days+=2

}else if(month==3||month==2){
days+=1
}
//2月判定
if(month>2){
days-=2
}
return ((days*24+hour)*60+min)*60+s
}
function time2(num){
hour=Math.floor(num/3600)
min=Math.floor(num%3600⁄60)
s=num-hour*3600-min*60
return {hour:hour,min:min,s:s}
}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/170759.html