MongoDB Time Zone issues

Source: Internet
Author: User

As a result of my work, I recently worked on a database that was MongoDB's Java project. The time in the project was found to be problematic, and the time to save the data was reduced by 8 hours.

Solutions

Add annotations before setting a time variable

@JsonFormat (pattern = "Yyyy-mm-dd HH:mm:ss", timezone= "Gmt+8")

Pattern is the time format setting (HH means 24-hour, HH for 12-hour), TimeZone is the time zone setting, we are in the East eight zone, so set this up.


This method hard-won, can't help to praise for their own! haha haha

MongoDB Time Zone issues

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.