us ua ua


How to change the date and time on FreeBSD

 

When I installed FreeBSD, I did not select the date and time zone and left it set to the default. I installed the desktop environment and everything was fine. But when I ran one program, I saw an error message that said the system time was wrong.

 

To see the current date just type in a terminal command

 

 

date

 

 

You'll get the current date like

 

Fri Aug 15 14:14:19 UTC 2015

 

 

To change the date and time in FreeBSD, use the same date command to enter the current time with the date in the following format.

 

 

date ccyymmddHHMM.ss

 

 

Now let's see what this means.

 

 

1. cc is current century

 

2. yy is year

 

3. mm is month of year

 

4. dd is day of the month

 

5. HH is clock

 

6. MM is minutes

 

7. .ss and then the seconds.

 

 

Like this

 

 

# date 201508151435

 

 

Let's check what we have

 

 

date

 

Fri Aug 15 14:35:00 UTC 2015

 

 

to change just the time, enter

 

 

date 1440

 

 

If you want to set seconds as well, do the following

 

 

date 1440.30

 

 

To set your time zone just copy your zone file from here /usr/share/zoneinfo to /etc/localtime

 

 

For example:

 

 

cp /usr/share/zoneinfo/Europe/Kiev/etc/localtime

 

 

Or

 

 

cp /usr/share/zoneinfo/Europe/Moscow/etc/localtime

 

 

 

That's it!