计算两日期之间的相差天数.java

来自「java源程序,两个类之间的函数转换,实现相应功能」· Java 代码 · 共 34 行

JAVA
34
字号
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package 阶段练习一;/** * * @author lenovo */public class 计算两日期之间的相差天数 {  日期 one,two,i;   int m=0;   计算两日期之间的相差天数(日期 x,日期 y)   {one=x;    two=y;   }   int 日期计算()   {   for(i=one;i.year<two.year;i.year++)   {if(i.闰年()==1)m=m+366;    else m=m+365;   }   for(i.month=1;i.month<one.month;i.month++)m=m-i.每月天数();   for(i=two,i.month=1;i.month<two.month;i.month++)m=m+i.每月天数();    m=m+two.day-one.day;    return m;   }}    

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?