由于不知名的原因,前端传来的日期数据被转换成了一串数字,导致入库失败
现需将数字转换为日期格式,代码如下:
public class DateTest {
public static void main(String[] args) throws ParseException {
long time = Long.parseLong("1999943299900");
Date date = new Date(time);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
String str = dateFormat.format(date);
System.out.println(str);
}
}