SimpleDateFormat is often used when dealing with dates in Java, but this class is not thread safe Some people may wonder what it is, but sadly I've been addicted to it lately ...
When the thread was crowded and the barber was flowing, the date of 1950 was messed up, so when I looked it up, it was like this
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public String getDate() {
return sdf.format(new Date());
}
this,
private final String pattern = "yyyy-MM-dd HH:mm:ss";
public String getDate() {
return new SimpleDateFormat(pattern).format(new Date());
}
Koya