24.6 C
Wednesday, September 22, 2021

FreeBSD change timezone – Linux Hint

Must read

This is going to be a quick post about changing time zones on a FreeBSD server. To cut to the chase, FreeBSD allows users to change timezones by simply using a date command variation. And we’ll show you exactly how to use this command and update the system date and time by messing things up.

Look up the current time and date in FreeBSD

To see what the current time and date in your FreeBSD system is, use the command below:

You should see the following output:

How to set date and time in FreeBSD

To change the date/time in your FreeBSD system, log into your root account, and use the syntax below:

where, of course, y is the two digits of years, m stands for the month(1-12), d stands for the day of the month(1-31), H stands for the hour of the day(0-23) and M stands for minutes(0-59).

Let’s say you want to change the date to November 19, 2020, at 09:33; you’d issue the command below:

How to change time in FreeBSD

To change the time in your FreeBSD system without changing the date, you can use the command syntax as under:

Let’s set the time to 21:33:

Changing timezones in FreeBSD

The command for switching to the local timezone in FreeBSD is tzsetup, scans the database for any timezone related information. The contents of this database are contained in the /usr/share/zoneinfo/zone.tab file, which is accessed when you run tzsetup.

Type out the command below to change the timezone on your FreeBSD system:

This should launch the terminal menu from which you can pick the timezone.

Select the timezone area matching your location, then select your country and type ok. You’ll be prompted to confirm the changes.

Once you hit enter to confirm changes, the system will update the timezone immediately. To verify this, you can use the date command again:

From the output above, it’s clear that the timezone switch from UTC to PKT(Pakistan Standard Time) has been successful.

Wrapping up

Changing timezones or time and date independently in FreeBSD is very easy. All you need to do is to use the appended date command to change the date and the tzsetup command to set the time.

Source link

- Advertisement -

More articles


Please enter your comment!
Please enter your name here

- Advertisement -

Latest article