欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

IT忍者神龟之date日期回顾

程序员文章站 2024-01-29 18:51:40
...

Calendar cal = Calendar.getInstance(); cal.get(Calendar.DAY_OF_MONTH); cal.get(Calendar.MONTH); cal.get(Calendar.YEAR); SimpleDateFormat simpleDateFormat = new SimpleDateFormat(yyyyMMdd); String date=simpleDateFormat.format(new Date()); Str

Calendar cal = Calendar.getInstance();

cal.get(Calendar.DAY_OF_MONTH);
cal.get(Calendar.MONTH);

cal.get(Calendar.YEAR);

SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
String date=simpleDateFormat.format(new Date());
String y=date.substring(0,4);
String m=date.substring(4,6);
String d=date.substring(6,8);