```java
import lombok.extern.slf4j.Slf4j;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* Created by babata on 2014/12/25.
*/
@Slf4j
public class DateUtil {
public static final String timeFormate = "yyyy-MM-dd HH:mm:ss";
public static final String dateFormate = "yyyy-MM-dd";
public static final String pannelTime = "yyyyMMddHHmmss";
public static final String yyyyMMdd = "yyyyMMdd";
public static final String HHMMSS = "HH:mm:ss";
/**
* 获取系统时间 年月日时分秒
* @return
*/
public static String nowDateTime(){
SimpleDateFormat sdf = new SimpleDateFormat(timeFormate);
Date date = new Date();
return sdf.format(date);
}
public static String nowDay(){
SimpleDateFormat sdf = new SimpleDateFormat(yyyyMMdd);
Date date = new Date();
return sdf.format(date);
}
public static long getDistaceLong(String dateStr) {
try {
SimpleDateFormat sdf = new SimpleDateFormat(timeFormate);
Date date = sdf.parse(dateStr);
return new Date().getTime() - date.getTime();
}catch (Exception e){
log.error("getDistaceLong error", e);
}
return 0;
}
public static String nowPannelDateTime(){
SimpleDateFormat sdf = new SimpleDateFormat(pannelTime);
Date date = new Date();
return sdf.format(date);
}
public static Long nowDateTimeLong() {
return new Date().getTime() ;
}
public static long time2Long(String time) {
SimpleDateFormat sdf = new SimpleDateFormat(timeFormate);
Date date = null;
try {
date = sdf.parse(time);
} catch (ParseException e) {
log.error("exe error", e);
}
return date.getTime();
}
/**
* 年月日
* @return
*/
public static String yyyyMMdd(){
SimpleDateFormat sdf = new SimpleDateFormat(yyyyMMdd);
Date date = new Date();
return sdf.format(date);
}
public static String nowDateTimeSimple(){
SimpleDateFormat sdf = new SimpleDateFormat(dateFormate);
Date date = new Date();
return sdf.format(date);
}
public static String getNowHour(){
SimpleDateFormat sdf = new SimpleDateFormat("HH");
Date date = new Date();
return sdf.format(date);
}
public static String getNowYear(){
SimpleDateFormat