版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wxm994116/article/details/78615486
private String calendarToString(Calendar calendar) throws Exception {
if (calendar == null) {
return null;
}
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");// 设置你想要的格式
String dateStr = df.format(calendar.getTime());
return dateStr;
}
关于时间转化,发现有个博客写的比我好多了,点击查看他的吧!!
时间的相互转化,有需要直接点击以下链接