摘要: // 将你的生日存储到String字符串变量中 String str = "1991年01月06日"; // 将当前时间存储到String字符串变量中 String today = "2021年4月22日"; // 创建日期格式化类对象,要和定义的字符串日期格式一致 SimpleDateFormat 阅读全文
posted @ 2021-04-22 21:25 一块 阅读(134) 评论(0) 推荐(0) 编辑
摘要: //按照年月日时分秒来输出获取到的日期Date d1 = new Date();//获取当前时间对象SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//创建日期格式化类对象System.out.println(s 阅读全文
posted @ 2021-04-22 20:56 一块 阅读(59) 评论(0) 推荐(0) 编辑
摘要: DateFormat dd1 = null; DateFormat dd2 = null; dd1 = DateFormat.getDateInstance(); //取得日期 dd2 = DateFormat.getDateTimeInstance();//取得日期 时间 System.out.p 阅读全文
posted @ 2021-04-22 11:22 一块 阅读(123) 评论(0) 推荐(0) 编辑
摘要: //获取到系统当前时间:年月日时分秒毫秒 Calendar calendar = null; calendar = new GregorianCalendar(); System.out.println("年:"+calendar.get(Calendar.YEAR)); System.out.pr 阅读全文
posted @ 2021-04-22 10:47 一块 阅读(2963) 评论(0) 推荐(0) 编辑