Skip to content

Setting Up Time and Timezone on Raspberry Pi via Terminal

This guide provides step-by-step instructions for configuring the system time and timezone on a Raspberry Pi using the terminal. These steps apply to Raspberry Pi OS and other Linux-based distributions.


1. Check Current System Time

Before making changes, check the current system time with:

date

This command displays the current date and time in the system's configured timezone.


2. Set the Timezone

To set the correct timezone, follow these steps:

List Available Timezones

To find the appropriate timezone, use:

timedatectl list-timezones
This will display all available timezones. You can scroll through the list or use grep to filter:
timedatectl list-timezones | grep America

Set the Timezone

Once you identify the correct timezone, set it with:

sudo timedatectl set-timezone <Your-Timezone>
For example, to set the timezone to Eastern Time (New York):
sudo timedatectl set-timezone America/New_York

To verify the change, run:

date
timedatectl status


3. Enable Network Time Synchronization (NTP)

For automatic time synchronization using an NTP server:

sudo timedatectl set-ntp on
sudo systemctl restart systemd-timesyncd
To check the synchronization status:
timedatectl status
Look for System clock synchronized: yes.

If the system is not syncing, try restarting the service:

sudo systemctl restart systemd-timesyncd


4. Manually Set the System Time (If No Internet Access)

If you do not have internet access and need to manually set the time:

sudo date -s "YYYY-MM-DD HH:MM:SS"
Example:
sudo date -s "2025-02-11 14:30:00"

To verify:

date


5. Configure the Hardware Clock (RTC)

If your Raspberry Pi has a Real-Time Clock (RTC) module, update the hardware clock to retain the time after reboots.

Save System Time to RTC

sudo hwclock --systohc

Set System Time from RTC

To restore system time from RTC on boot:

sudo hwclock --hctosys

To check the RTC time:

sudo hwclock -r


6. Verify All Changes

After making changes, confirm the configuration with:

date
timedatectl status
This ensures the correct timezone and time synchronization settings are applied.

By following this guide, you can ensure that your Raspberry Pi maintains accurate time settings, even across reboots and network changes.