You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 23, 2024. It is now read-only.
fastjson 1.2.22版本
Jdk8DateCodec.java
LocalDateTime dateTime = (LocalDateTime) object;
if (dateTime.getNano() == 0) {
String format = serializer.getDateFormatPattern();
if (format == null) {
format = JSON.DEFFAULT_DATE_FORMAT;
}
write(out, dateTime, format);
} else {
out.writeString(object.toString());
}
看 这里是 dateTime.getNano() == 0 才会进行format处理,LocalDateTime.now()产生的时间,都是不成立的,所以在toString时,即使是这样设置,都不会生效:
@OverRide
public String toString() {
return JSON.toJSONStringWithDateFormat(this,"yyyy-MM-dd HH:mm:ss:SSS",
SerializerFeature.DisableCircularReferenceDetect);
}
按理纳秒都要能处理啊。
