{"id":206341,"date":"2023-12-28T13:25:37","date_gmt":"2023-12-28T13:25:37","guid":{"rendered":"https:\/\/ded9.com\/?p=206341"},"modified":"2025-10-12T08:03:42","modified_gmt":"2025-10-12T08:03:42","slug":"how-to-change-time-zone-in-centos","status":"publish","type":"post","link":"https:\/\/ded9.com\/tr\/how-to-change-time-zone-in-centos\/","title":{"rendered":"How to Change the Time Zone in CentOS"},"content":{"rendered":"<p data-pm-slice=\"1 1 []\">Setting the correct time zone on your CentOS server is essential for accurate logging, reporting, and automated processes like cron jobs. This guide explains how to review, set, and manage the time zone in CentOS 7 step-by-step.<\/p>\n<h2 data-pm-slice=\"1 1 []\"><strong>Access Your Server and CentOS via SSH<\/strong><\/h2>\n<p>To begin, connect to your server via SSH. Use the following command:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">ssh user@your_server_ip<\/pre>\n<\/div>\n<p data-pm-slice=\"1 1 []\">Replace <code>user<\/code> with your username and <code>your_server_ip<\/code> with your server&#8217;s IP address.<\/p>\n<h2 data-pm-slice=\"1 1 []\"><strong>Step 1: Check Current Time Zone<\/strong><\/h2>\n<p>You can check your server\u2019s current time and time zone using the <code>date<\/code> or <code>timedatectl<\/code> commands.<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">date<\/pre>\n<\/div>\n<p data-pm-slice=\"1 1 []\">Example output:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">Fri Mar 15 14:52:20 UTC 2019<\/pre>\n<\/div>\n<p data-pm-slice=\"1 1 []\">Alternatively, use <code>timedatectl<\/code>:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">timedatectl<\/pre>\n<\/div>\n<p data-pm-slice=\"1 1 []\">Example output:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">Local time: Fri 2019-03-15 14:54:51 UTC\r\nUniversal time: Fri 2019-03-15 14:54:51 UTC\r\nRTC time: n\/a\r\nTime zone: UTC (UTC, +0000)\r\nNTP enabled: yes\r\nNTP synchronized: yes\r\nDST active: n\/a<\/pre>\n<\/div>\n<h2 data-pm-slice=\"1 1 []\"><strong>Step 2: List Available Time Zones<\/strong><\/h2>\n<p>To list all available time zones:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">timedatectl list-timezones<\/pre>\n<\/div>\n<p data-pm-slice=\"1 1 []\">This will display a comprehensive list of supported time zones in alphabetical order. Use <code>grep<\/code> To refine your search. For instance, to search for Pacific time zones:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">timedatectl list-timezones | grep Pacific<\/pre>\n<\/div>\n<h2 data-pm-slice=\"1 1 []\"><strong>Step 3: Set the Time Zone<\/strong><\/h2>\n<p>Once you&#8217;ve identified the desired time zone, use the following command to set it:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">timedatectl set-timezone &lt;Time_Zone&gt;<\/pre>\n<\/div>\n<p data-pm-slice=\"1 1 []\">Replace <code>&lt;Time_Zone&gt;<\/code> with the desired time zone, such as <code>America\/Chicago<\/code> or <code>Asia\/Dubai<\/code>.<\/p>\n<p>Example:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">timedatectl set-timezone America\/Chicago<\/pre>\n<p data-pm-slice=\"1 1 []\">After setting, verify the new time zone with:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">timedatectl<\/pre>\n<\/div>\n<h2 data-pm-slice=\"1 1 []\"><strong>Step 4: Set the System Date and Time (Optional)<\/strong><\/h2>\n<p data-pm-slice=\"1 1 []\">To manually set the date and time, use the following format:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">timedatectl set-time 'YYYY-MM-DD HH:MM:SS'<\/pre>\n<\/div>\n<p data-pm-slice=\"1 1 []\">Example:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">timedatectl set-time '2019-03-16 09:20:00'<\/pre>\n<\/div>\n<p data-pm-slice=\"1 1 []\">Verify the updated date and time with:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">date<\/pre>\n<\/div>\n<h2 data-pm-slice=\"1 1 []\"><strong>Step 5: Configure the Hardware Clock<\/strong><\/h2>\n<p>The hardware clock (RTC) operates even when the system is powered off. To check if it&#8217;s using the local time zone:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">timedatectl | grep local<\/pre>\n<\/div>\n<p data-pm-slice=\"1 1 []\">Output:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">RTC in local TZ: no<\/pre>\n<\/div>\n<p data-pm-slice=\"1 1 []\">To set the hardware clock to the local time zone:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">timedatectl set-local-rtc 1<\/pre>\n<\/div>\n<p data-pm-slice=\"1 1 []\">To revert this setting:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">timedatectl set-local-rtc 0<\/pre>\n<\/div>\n<h2 data-pm-slice=\"1 1 []\"><strong>Step 6: Enable NTP Synchronization<\/strong><\/h2>\n<p data-pm-slice=\"1 1 []\">Network Time Protocol (<a href=\"https:\/\/en.wikipedia.org\/wiki\/Network_Time_Protocol\" target=\"_blank\" rel=\"noopener\">NTP<\/a>) synchronizes system time with remote servers. If not already installed, first install NTP:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">yum install ntp -y<\/pre>\n<\/div>\n<p data-pm-slice=\"1 1 []\">To enable NTP synchronization:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">timedatectl set-ntp true<\/pre>\n<\/div>\n<p data-pm-slice=\"1 1 []\">To disable it:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">timedatectl set-ntp false<\/pre>\n<\/div>\n<p data-pm-slice=\"1 1 []\">Verify NTP synchronization status:<\/p>\n<div class=\"wp-block-codemirror-blocks code-block \">\n<pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;shell&quot;,&quot;mime&quot;:&quot;text\/x-sh&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:false,&quot;lineWrapping&quot;:false,&quot;styleActiveLine&quot;:false,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;&quot;}\">timedatectl<\/pre>\n<\/div>\n<h2 data-pm-slice=\"1 1 []\"><strong>Best Practices<\/strong><\/h2>\n<ol start=\"1\" data-spread=\"false\">\n<li>Double-check the impact of time zone changes on server applications, especially cron jobs and logs.<\/li>\n<li>Use NTP synchronization to maintain accurate system time.<\/li>\n<li>Document the changes for future reference or audits.<\/li>\n<\/ol>\n<p>Following these steps ensures your server\u2019s time zone is configured correctly for smooth operations.<\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-254137\" src=\"https:\/\/ded9.com\/wp-content\/uploads\/2023\/12\/How-to-Change-Time-Zone-in-CentOS-7.png\" alt=\"How to Change Time Zone in CentOS 7\" width=\"855\" height=\"440\" srcset=\"https:\/\/ded9.com\/wp-content\/uploads\/2023\/12\/How-to-Change-Time-Zone-in-CentOS-7.png 855w, https:\/\/ded9.com\/wp-content\/uploads\/2023\/12\/How-to-Change-Time-Zone-in-CentOS-7-300x154.png 300w, https:\/\/ded9.com\/wp-content\/uploads\/2023\/12\/How-to-Change-Time-Zone-in-CentOS-7-768x395.png 768w\" sizes=\"(max-width: 855px) 100vw, 855px\" \/><\/p>\n<\/div>\n<h2>Conclusion<\/h2>\n<p>Correctly setting the time zone on your <a href=\"https:\/\/ded9.com\/how-to-change-time-zone-in-centos\/\">CentOS<\/a> 7 server is essential for ensuring accurate logging, smooth operation of automated tasks like cron jobs, and effective server management. By following the outlined steps\u2014from checking the current time zone to enabling NTP synchronization\u2014you can ensure that your server maintains the correct time, ultimately enhancing system reliability and preventing potential issues.<\/p>\n<p>Always verify your changes and consider any impact they may have on applications running on your server. Utilizing NTP synchronization is a recommended best practice to keep your server&#8217;s time accurate.<\/p>\n<h2>FAQ<\/h2>\n<div id=\"rank-math-rich-snippet-wrapper\"><div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-1\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">How can I list all available time zones in CentOS?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Run the command: timedatectl list-timezones This will display a list of all time zones. You can also search for a specific region by piping the output: timedatectl list-timezones | grep Asia<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-2\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">What should I do if timedatectl is not available on my CentOS version?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>For older CentOS versions, you can change the time zone by creating a symbolic link: ln -sf \/usr\/share\/zoneinfo\/Asia\/Kolkata \/etc\/localtime Then, update the system clock configuration: echo \"ZONE=\"Asia\/Kolkata\"\" &gt; \/etc\/sysconfig\/clock<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-3\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">How can I verify the current time zone on my CentOS system?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Use the following command to display the current time zone: timedatectl Alternatively, you can check the symbolic link: ls -l \/etc\/localtime<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Setting the correct time zone on your CentOS server is essential for accurate logging, reporting, and automated processes like cron jobs. This guide explains how to review, set, and manage the time zone in CentOS 7 step-by-step. Access Your Server and CentOS via SSH To begin, connect to your server via SSH. Use the following [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":206342,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11516],"tags":[4904,11446,3086],"class_list":["post-206341","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos-2","tag-centos","tag-time-zone","tag-vps"],"acf":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/posts\/206341","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/comments?post=206341"}],"version-history":[{"count":7,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/posts\/206341\/revisions"}],"predecessor-version":[{"id":263341,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/posts\/206341\/revisions\/263341"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/media\/206342"}],"wp:attachment":[{"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/media?parent=206341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/categories?post=206341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/tags?post=206341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}