[Java] 纯文本查看 复制代码
public class Gongce {
public static void main(String[] args) throws ParseException {
Scanner ner = new Scanner(System.in);
System.out.println("请输入您入职的日期,格式为:xxxx年xx月xx日");
String s = ner.next();
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
Date parse = sdf.parse(s);
System.out.println("您一共做了"+(date.getTime()-parse.getTime()/1000/60/60/24)+"天程序员!");
}