亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

java - mongodb里Date字段的問題
阿神
阿神 2017-04-18 10:44:26
0
3
636
阿神
阿神

閉關(guān)修行中......

reply all(3)
Ty80

Date type data in MongoDB only saves absolute time values ??and does not save time zone information, so the "displayed time" depends on the MongoDB client settings.

Based on the screenshot, I guess Robomongo is used. You can set the display of local time through "Options" - "Display Dates in..." - "Local Timezone".

劉奇

mongoDB默認按照UTC來存儲時間,而我們中國所處時區(qū)通常叫做“東八區(qū)”,意思是UTC + 8, so as you said, the deposit time seems to be "8 hours earlier" than it actually is. Documentation

Perhaps you can try setting the default time zone of the application when it starts?

TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));

Because it’s uselessjava操作過mongoDB, I can’t guarantee it’s absolutely correct, but you can try it

PHPzhong

The time you saved is the time of your server. Is it displayed normally? Does it mean it is consistent with the local time? Then you need to calculate the time zone and add the time difference when saving.

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