标签:get time tin settime 时间 util 转化 str parse
//获取当前时间的具体情况,如年,月,日,week,date,分,秒等
Calendar calendat = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String dateStr = sdf.format(calendar.getTime());
String str="2010-5-27";
SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd");
Date date =sdf.parse(str);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd");
String dateStr=sdf.format(new Date());
String str="2010-5-27";
SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd");
Date birthday = sdf.parse(str);
Calendar calendar = Calendar.getInstance();
calendar.setTime(new java.util.Date());
Calendar calendar = Calendar.getInstance();
java.util.Date date =calendar.getTime();
JAVA Date、String、Calendar类型之间的转化
标签:get time tin settime 时间 util 转化 str parse
原文地址:https://www.cnblogs.com/eggtomcato/p/10265918.html