forked from zhangyuan/epmet-cloud-lingshan
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
755 B
30 lines
755 B
package io.renren.utils;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.Date;
|
|
|
|
/**
|
|
* 日期处理
|
|
*
|
|
* @author chenshun
|
|
* @email sunlightcs@gmail.com
|
|
* @date 2016年12月21日 下午12:53:33
|
|
*/
|
|
public class DateUtils {
|
|
/** 时间格式(yyyy-MM-dd) */
|
|
public final static String DATE_PATTERN = "yyyy-MM-dd";
|
|
/** 时间格式(yyyy-MM-dd HH:mm:ss) */
|
|
public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
|
|
|
|
public static String format(Date date) {
|
|
return format(date, DATE_PATTERN);
|
|
}
|
|
|
|
public static String format(Date date, String pattern) {
|
|
if(date != null){
|
|
SimpleDateFormat df = new SimpleDateFormat(pattern);
|
|
return df.format(date);
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
|