quartzPro/.svn/pristine/8e/8e6ddf21c656e1b7fb6016984ec...

36 lines
874 B
Plaintext

package com.ifish.jpush.utils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class TimeUtils {
private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
private static final String TIME_ONLY_FORMAT = "HH:mm:ss";
public static boolean isDateFormat(String time) {
try {
SimpleDateFormat format = new SimpleDateFormat(DATE_FORMAT);
format.setLenient(false);
format.parse(time);
} catch (ParseException e) {
return false;
}
return true;
}
public static boolean isTimeFormat(String time) {
try{
SimpleDateFormat format = new SimpleDateFormat(TIME_ONLY_FORMAT);
format.setLenient(false);
format.parse(time);
} catch (ParseException e) {
return false;
}
return true;
}
}