Java get timestamp problem on Linux system

Source: Internet
Author: User

  1. Time zone settings:

    To start setting the time zone, refer to the information on the Internet, using the Tzselect command, and found that the Tzselect command only tells the way to set the time zone, not really to modify/etc/sysconfig/clock this file. In other words, the tzselect command simply tells us to select the time zone by setting the TZ environment variable, and then add the variable to the. profile file. Here's a quick introduction to how to set the time zone using the Tzselect command, and how to set the time zone by modifying the/etc/sysconfig/clock configuration file.

  2. Tzselect:

    Execute the tzselect command--Select asia--> Select china--> Select East China-beijing, Guangdong, Shanghai, etc--> and enter 1. Process such as:

  3. After executing the tzselect command to select the time zone, the time zone does not change, but the command finally prompts you to execute tz= ' Asia/shanghai '; Export TZ and add this line of command to the. Profile, then exit and log back in. Refer to the results as seen in the Date command, and the final time zone is shown as CST, China Standard Time.

  4. Modify the configuration file to modify the time zone 1, modify/etc/sysconfig/clock Zone=asia/shanghai

    2, Rm/etc/localtime3, link to the Shanghai time zone file

    Ln-sf/usr/share/zoneinfo/asia/shanghai/etc/localtime

    After performing the above procedure, restart the machine to see that the time zone has changed.



Java get timestamp problem on Linux system

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.