java - fastjson處理日期類型轉(zhuǎn)換各種方法的優(yōu)劣
問(wèn)題描述
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);
求助一下大神在高并發(fā)下在轉(zhuǎn)換的準(zhǔn)確的基礎(chǔ)上,哪個(gè)性能更好一些
問(wèn)題解答
回答1:傳時(shí)間最好是用Unix時(shí)間戳(用秒還是毫秒,兩邊約定好就可以了)。
用yyyy-MM-dd HH:mm:ss的話,碰到兩邊服務(wù)器時(shí)區(qū)不一樣,多半要出問(wèn)題的。
相關(guān)文章:
1. docker容器呢SSH為什么連不通呢?2. docker - 如何修改運(yùn)行中容器的配置3. 關(guān)docker hub上有些鏡像的tag被標(biāo)記““This image has vulnerabilities””4. docker start -a dockername 老是卡住,什么情況?5. Android TextView 或 ListView 加載過(guò)渡效果6. docker - 各位電腦上有多少個(gè)容器啊?容器一多,自己都搞混了,咋辦呢?7. python - thrift 返回 TSocket read 0 bytes 求助!!!!8. python3.x - python中import theano出錯(cuò)9. python - (初學(xué)者)代碼運(yùn)行不起來(lái),求指導(dǎo),謝謝!10. python - django模板 include模板的數(shù)據(jù)問(wèn)題
