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
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.