io.gitee.putaoo.easypay.util.DateUtil Maven / Gradle / Ivy
package io.gitee.putaoo.easypay.util;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateUtil {
public static String yyyyMMddHHmmss(Long timestamp){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.format(new Date(timestamp));
}
public static long yyyyMMddHHmmss(String yyyyMMddHHmmss){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
return sdf.parse(yyyyMMddHHmmss).getTime();
}catch (Exception e){
return 0;
}
}
}