About Calendar type conversion into a predetermined format of time

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. 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;
    }

About the time the conversion was found to have a blog to write better, click to see him than me! !
Into each other's time, there is need to click on the link below

By transcoding instance, you can click on the following link

Guess you like

Origin blog.csdn.net/wxm994116/article/details/78615486