com.kingsoft.services.util.DateUtils Maven / Gradle / Ivy
package com.kingsoft.services.util;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DateUtils {
private static final String DATA_FORMAT_STR = "yyyy-MM-dd HH:mm:ss";
public static String format(Date date) {
DateFormat dateFormat = new SimpleDateFormat(DATA_FORMAT_STR);
return dateFormat.format(date);
}
public static Date parse(String value) throws ParseException {
DateFormat dateFormat = new SimpleDateFormat(DATA_FORMAT_STR);
return dateFormat.parse(value);
}
public static String getTimeNow() {
return format(Calendar.getInstance().getTime());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy