Jump to content

FreeBSD change timezone


Linux Hint

Recommended Posts

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:

$ date

You should see the following output:

word-image-84.jpeg

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:

$ date yymmddHHMM

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:

$ date 2011190955

word-image-85.jpeg

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:

$ date HHMM

Let’s set the time to 21:33:

$ date 2133

word-image-86.jpeg

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:

$ tzsetup

word-image-87.jpeg

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:

$ date

word-image-88.jpeg

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.

View the full article

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...