DWQA QuestionsCategory: ServerFastjson deals with the advantages and disadvantages of various methods for date type conversion
Silver asked 2 months ago
ExpIssue exp = new ExpIssue();
    exp.setCreateTime(new Date());
    exp.setDealContent("liahodbfoasdhf");
The first: string jstr = json.tojsonstringwithdateformat (exp, "yyyy MM DD HH: mm: SS");
The second type: String ste = json.tojsonstring (exp, serializerfeature. Writedateusedateformat);
The third type: serializeconfig mapping = new serializeconfig();
       mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss"));
       String json = JSONObject.toJSONString(issue,mapping,SerializerFeature.WriteDateUseDateFormat);

Ask the great God for help. On the basis of accurate conversion, which performance is better,It’s better to use UNIX timestamp (in seconds or milliseconds, it’s ok if both sides agree).
useyyyy-MM-dd HH:mm:ssIf the time zones of the servers on both sides are different, there will probably be problems.

1 Answers
auntyellow answered 2 months ago

It’s better to use UNIX timestamp (in seconds or milliseconds, it’s ok if both sides agree).
useyyyy-MM-dd HH:mm:ssIf the time zones of the servers on both sides are different, there will probably be problems.