java - The pros and cons of various methods for fastjson to handle date type conversion
世界只因有你
世界只因有你 2017-06-10 09:48:00
0
1
742
ExpIssue exp = new ExpIssue();
    exp.setCreateTime(new Date());
    exp.setDealContent("liahodbfoasdhf");
第一种: String jstr = JSON.toJSONStringWithDateFormat(exp, "yyyy-MM-dd HH:mm:ss");
第二种: String ste =  JSON.toJSONString(exp, SerializerFeature.WriteDateUseDateFormat);
第三种:SerializeConfig mapping = new SerializeConfig();
       mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss"));
       String json = JSONObject.toJSONString(issue,mapping,SerializerFeature.WriteDateUseDateFormat);
            
            

Please ask the experts for help, which one has better performance on the basis of accurate conversion under high concurrency

世界只因有你
世界只因有你

reply all(1)
淡淡烟草味

It is best to use Unix timestamp when transmitting time (seconds or milliseconds, just agree on both sides).

If you use yyyy-MM-dd HH:mm:ss, if the time zones of the two servers are different, there will probably be problems.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template