出生到现在多少天
来源:互联网 发布:微商软件必备 编辑:程序博客网 时间:2024/04/27 21:47
import java.util.Calendar;
/**
* @author Rory
* @category 计算出生到现在共多少天
*/
public class Birthday {
private int year;
private int month;
private int day;
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public int getDay() {
return day;
}
public void setDay(int day) {
this.day = day;
}
public long getHours(){
Calendar c= Calendar.getInstance();//获取日历
c.set(year,month,day); //设置出生日期
return(System.currentTimeMillis()-c.getTimeInMillis())/(1000L*60*60*24);
}
public static void main(String[] args) {
Birthday b=new Birthday();
//出生日期
b.year=1994;
b.month=10;
b.day=28;
System.out.println("今天是第"+b.getHours()+"天");
}
}
/**
* @author Rory
* @category 计算出生到现在共多少天
*/
public class Birthday {
private int year;
private int month;
private int day;
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public int getDay() {
return day;
}
public void setDay(int day) {
this.day = day;
}
public long getHours(){
Calendar c= Calendar.getInstance();//获取日历
c.set(year,month,day); //设置出生日期
return(System.currentTimeMillis()-c.getTimeInMillis())/(1000L*60*60*24);
}
public static void main(String[] args) {
Birthday b=new Birthday();
//出生日期
b.year=1994;
b.month=10;
b.day=28;
System.out.println("今天是第"+b.getHours()+"天");
}
}
0 0
- 出生到现在多少天
- Java:计算出生到现在多少天代码
- 蓝桥杯 C++ 计算出生到现在已经过了多少天
- 计算你从出生到今天活了多少天,今年多少岁
- 判断从出生到18岁生日一共度过了多少天
- 计算某人已经出生了多少天?
- java小案例:计算你现在到出生的天数
- hdu1201(从出生长18岁经过多少天)
- 一个刚出生的奶牛,4年生一只,以后每年生一只,现在有一只刚出生的奶牛,问20年以后一共多少只奶牛?
- 一个刚出生的奶牛,4年生一只,以后每年生一只,现在有一只刚出生的奶牛,问20年以后一共多少只奶牛?
- 刚学循环写的代码,出生到现在是第几天?
- 从女儿出生到现在,我只看了她一眼,为女儿祈福
- 按年从先到晚查询一个数据表中有多少个同一年出生(脚本)
- js实现某年某月某天距离现在有多少天,多少分,多少秒,动态显示!
- 计算现在到1970年过了多少秒 mktime函数 自己写的 ^_^
- js计算现在到某一个时刻还有多少时间的代码
- 计算从现在到凌晨00:00还剩余多少秒(redis缓存经常使用)
- 小宝宝出生第二天
- 剑指offer-整数中1出现的次数
- Git merge 冲突解决简明教程
- MongoDB 数据存储引擎
- Linux下查看用户列表
- codevs 3955 最长严格上升子序列(加强版)
- 出生到现在多少天
- MySQL 备份还原
- JAVA入门笔记1:基本语法、常量、变量
- Activity与Fragment通信
- 第九周练习--第几天
- 如何制作unity艺术字体
- 用autoit写了一个珠心神算的小程序(数学运算)
- ActivityManagerService的启动
- Hadoop命令学习