Now I am parsing datetime from frontend like this:
public static Long stringToUnixTimestampMinisecend(String datetime) {
Long resultDatetime = 0L;
try {
Date startLocalTime = DateUtils.parseDate(datetime, DATETIME_PATTERN);
resultDatetime = startLocalTime.getTime();
} catch (Exception e) {
Log.error("parse error", e);
}
return resultDatetime;
}
this is the DATETIME_PATTERN define:
public final static String[] DATETIME_PATTERN = {
"yyyy-MM-dd HH:mm:ss",
"yyyy-MM-dd",
};
but now I want to know the frontend parameter is contain minisecond, if the format like this 2020-11-05 23:59:59
, then I could append 999
in the end of parsed date(default is 000
). what should I do to make this?