{"id":540,"date":"2024-10-29T17:01:06","date_gmt":"2024-10-29T17:01:06","guid":{"rendered":"https:\/\/cpanelwebhosting.co.in\/articles\/?p=540"},"modified":"2024-10-29T17:01:10","modified_gmt":"2024-10-29T17:01:10","slug":"how-to-change-the-server-time-in-linux-using-timedatectl","status":"publish","type":"post","link":"https:\/\/cpanelwebhosting.co.in\/articles\/how-to-change-the-server-time-in-linux-using-timedatectl\/","title":{"rendered":"How to Change the Server Time in Linux Using timedatectl: A Best Guide"},"content":{"rendered":"\n<p>Correct time configuration is essential for server management, affecting processes like logging, scheduling, and synchronization. In <a href=\"https:\/\/www.linux.org\/\" rel=\"nofollow noopener\" target=\"_blank\">Linux<\/a>, the timedatectl command provides a streamlined method for managing and adjusting the system time, making it easy to set or correct server time accurately. In this guide, we\u2019ll explore how to change the server time in Linux using timedatectl, covering different time-related configurations.<\/p>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Table of Contents<\/h2><nav><ul><li><a href=\"#introduction-to-timedatectl\">Introduction to timedatectl<\/a><\/li><li><a href=\"#checking-the-current-server-time\">Checking the Current Server Time<\/a><\/li><li><a href=\"#setting-the-local-time\">Setting the Local Time<\/a><\/li><li><a href=\"#change-the-server-time-zone\">Change the Server Time Zone<\/a><\/li><li><a href=\"#uses-of-timedatctl-command-in-linux\">Uses of timedatctl command in Linux<\/a><\/li><li><a href=\"#final-thoughts\">Final Thoughts<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"introduction-to-timedatectl\">Introduction to <code>timedatectl<\/code><\/h3>\n\n\n\n<p><code>timedatectl<\/code> is a command-line utility in Linux that interacts with the <strong>systemd-timesyncd<\/strong> or other time synchronization services to configure and manage time settings on a server. This command allows you to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check current time and time zone settings<\/li>\n\n\n\n<li>Set the time and date manually<\/li>\n\n\n\n<li>Adjust the time zone<\/li>\n\n\n\n<li>Enable or disable NTP synchronization<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"checking-the-current-server-time\">Checking the Current Server Time<\/h3>\n\n\n\n<p>Before making any adjustments, it\u2019s essential to check the current server time to see if any changes are required.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"645\" height=\"271\" src=\"https:\/\/cpanelwebhosting.co.in\/articles\/wp-content\/uploads\/2024\/10\/timezone.png\" alt=\"timezone - change the server time\" class=\"wp-image-543\" srcset=\"https:\/\/cpanelwebhosting.co.in\/articles\/wp-content\/uploads\/2024\/10\/timezone.png 645w, https:\/\/cpanelwebhosting.co.in\/articles\/wp-content\/uploads\/2024\/10\/timezone-300x126.png 300w\" sizes=\"(max-width: 645px) 100vw, 645px\" \/><\/figure><\/div>\n\n\n<pre class=\"wp-block-preformatted\"><code>timedatectl<\/code><\/pre>\n\n\n\n<p>This command displays detailed time-related information, including:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Local time<\/li>\n\n\n\n<li>Universal Coordinated Time (UTC)<\/li>\n\n\n\n<li>Time zone<\/li>\n\n\n\n<li>NTP synchronization status<\/li>\n<\/ul>\n\n\n\n<p>The output will look something like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>         Local time: Thu 2024-10-29 12:00:00 IST<br>       Universal time: Thu 2024-10-29 06:30:00 UTC<br>          RTC time: Thu 2024-10-29 06:30:00<br>          Time zone: Asia\/Kolkata (IST, +0530)<br>System clock synchronized: yes<br>          NTP service: active<br>          RTC in local TZ: no<\/code><\/pre>\n\n\n\n<p>If your server time or time zone is incorrect, you can easily adjust it with the following steps.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"setting-the-local-time\">Setting the Local Time<\/h3>\n\n\n\n<p>To manually set the local time on your Linux server, use the <code>timedatectl set-time<\/code> command followed by the date and time in <code>YYYY-MM-DD HH:MM:SS<\/code> format.<\/p>\n\n\n\n<p>For example, to set the server time to October 30, 2024, at 13:30, you would enter:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>timedatectl set-time \"2024-10-30 13:30:00\"<\/code><\/pre>\n\n\n\n<p><strong>Note<\/strong>: Make sure to use <code>sudo<\/code> if you\u2019re not logged in as the root user, as setting the server time requires <a href=\"https:\/\/cpanelwebhosting.co.in\/cpanel-vps-hosting\/\" rel=\"nofollow\">superuser privileges<\/a>.<\/p>\n\n\n\n<p>After setting the time, run <code>timedatectl<\/code> again to confirm the changes:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>timedatectl<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"change-the-server-time-zone\">Change the Server Time Zone<\/h3>\n\n\n\n<p>Time zone configuration is crucial, especially for servers supporting users or applications in specific geographic regions. You can list available time zones using:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo <code>timedatectl list-timezones<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"956\" height=\"738\" src=\"https:\/\/cpanelwebhosting.co.in\/articles\/wp-content\/uploads\/2024\/10\/list-timezones.png\" alt=\"list timezones - change the server time\" class=\"wp-image-541\" style=\"width:554px;height:auto\" srcset=\"https:\/\/cpanelwebhosting.co.in\/articles\/wp-content\/uploads\/2024\/10\/list-timezones.png 956w, https:\/\/cpanelwebhosting.co.in\/articles\/wp-content\/uploads\/2024\/10\/list-timezones-300x232.png 300w, https:\/\/cpanelwebhosting.co.in\/articles\/wp-content\/uploads\/2024\/10\/list-timezones-768x593.png 768w\" sizes=\"(max-width: 956px) 100vw, 956px\" \/><\/figure><\/div>\n\n\n<p>Scroll or search through the output to find your desired time zone. To set the server to a new time zone, use:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>timedatectl set-timezone &lt;Time_Zone><\/code><\/pre>\n\n\n\n<p>Replace <code>&lt;Time_Zone&gt;<\/code> with your chosen time zone, such as <code>Asia\/Kolkata<\/code> or <code>America\/New_York<\/code>.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>timedatectl set-timezone Asia\/Kolkata<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"730\" height=\"286\" src=\"https:\/\/cpanelwebhosting.co.in\/articles\/wp-content\/uploads\/2024\/10\/set-time-zone-1-1.png\" alt=\"set time zone\" class=\"wp-image-542\" style=\"width:725px;height:auto\" srcset=\"https:\/\/cpanelwebhosting.co.in\/articles\/wp-content\/uploads\/2024\/10\/set-time-zone-1-1.png 730w, https:\/\/cpanelwebhosting.co.in\/articles\/wp-content\/uploads\/2024\/10\/set-time-zone-1-1-300x118.png 300w\" sizes=\"(max-width: 730px) 100vw, 730px\" \/><\/figure><\/div>\n\n\n<p>After setting, verify the time zone by running:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>timedatectl<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"uses-of-timedatctl-command-in-linux\">Uses of timedatctl command in Linux<\/h3>\n\n\n\n<p>The <code>timedatectl<\/code> command in Linux is a powerful utility for managing date, time, and time zone settings on a system. Its primary functions include viewing and setting the system time, adjusting the time zone, and controlling NTP (Network Time Protocol) synchronization.<\/p>\n\n\n\n<p><strong>1. Displaying Current Time Settings<\/strong>: Running <code>timedatectl<\/code> without any options shows the local time, UTC, time zone, and NTP synchronization status. This overview helps users quickly check if time settings are correct.<\/p>\n\n\n\n<p><strong>2. Setting Date and Time<\/strong>: With <code>timedatectl set-time<\/code>, administrators can manually set the system\u2019s date and time using the <code>YYYY-MM-DD HH:MM:SS<\/code> format. This is useful in situations where precise control of time is required.<\/p>\n\n\n\n<p><strong>3. Adjusting the Time Zone<\/strong>: By listing and setting time zones, <code>timedatectl<\/code> allows systems to match local times in various <a href=\"https:\/\/maps.google.com\/\" rel=\"nofollow noopener\" target=\"_blank\">geographical areas<\/a>. This ensures proper time display for servers operating in specific regions.<\/p>\n\n\n\n<p><strong>4. Enabling or Disabling NTP Sync<\/strong>: NTP synchronization keeps the server\u2019s clock accurate by syncing it with network time servers. <code>timedatectl set-ntp true<\/code> enables this feature, which is crucial for applications and logs that rely on precise time.<\/p>\n\n\n\n<p>In summary, <code>timedatectl<\/code> is essential for ensuring accurate time management, necessary for <a href=\"https:\/\/cpanelwebhosting.co.in\/cpanel-vps-hosting\/\" rel=\"nofollow\">server performance<\/a> and reliability.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"final-thoughts\">Final Thoughts<\/h3>\n\n\n\n<p>Using <code>timedatectl<\/code> to <a href=\"https:\/\/cpanelwebhosting.co.in\/cpanel-dedicated-server\/\" rel=\"nofollow\">manage your server<\/a>&#8216;s time and time zone is an efficient way to maintain correct time settings, essential for server performance and accuracy. Proper time configuration ensures smooth logging, scheduling, and time-sensitive applications. With <code>timedatectl<\/code>, you have a powerful, straightforward tool to handle time adjustments and synchronization, enhancing server stability and reliability. <\/p>\n\n\n\n<p>By following these steps, you should be able to configure and verify the server time, set the correct time zone, and maintain accurate time using timedatectl or contact <a href=\"https:\/\/www.cpanelwebhosting.co.in\/\" rel=\"nofollow\">your hosting provider<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Correct time configuration is essential for server management, affecting processes like logging, scheduling, and synchronization. In Linux, the timedatectl command provides a streamlined method for managing and adjusting the system&hellip;<\/p>\n","protected":false},"author":1,"featured_media":544,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,11],"tags":[13,18,17],"class_list":["post-540","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","category-control-panel","tag-cpanel","tag-server","tag-timezone"],"_links":{"self":[{"href":"https:\/\/cpanelwebhosting.co.in\/articles\/wp-json\/wp\/v2\/posts\/540"}],"collection":[{"href":"https:\/\/cpanelwebhosting.co.in\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cpanelwebhosting.co.in\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cpanelwebhosting.co.in\/articles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cpanelwebhosting.co.in\/articles\/wp-json\/wp\/v2\/comments?post=540"}],"version-history":[{"count":1,"href":"https:\/\/cpanelwebhosting.co.in\/articles\/wp-json\/wp\/v2\/posts\/540\/revisions"}],"predecessor-version":[{"id":545,"href":"https:\/\/cpanelwebhosting.co.in\/articles\/wp-json\/wp\/v2\/posts\/540\/revisions\/545"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cpanelwebhosting.co.in\/articles\/wp-json\/wp\/v2\/media\/544"}],"wp:attachment":[{"href":"https:\/\/cpanelwebhosting.co.in\/articles\/wp-json\/wp\/v2\/media?parent=540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cpanelwebhosting.co.in\/articles\/wp-json\/wp\/v2\/categories?post=540"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cpanelwebhosting.co.in\/articles\/wp-json\/wp\/v2\/tags?post=540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}