Here I will explain how to set time in Linux. Often times, we set the time, reboot, and it is messed up again. This is because the BIOS time is different, and Linux will Sync up to that. Lets see how we can get a hold of this whole mess...

To check the time, type

date

This will show you the system time, which is what Linux believe the current time is. In my case, the date was find, only the time would be off with an hour or two. To set the system time to a certain hour and minute, pass the following command. In my example I will set the time to 13:05, obviously plug in your own time to the command:

date -s 13:05

When this command is passed, a confirmation will come back stating the time currently the system is set to. If correct you are done here. Now make sure the system will not reset it when rebooted. Lets check the Hardware time, which is the BIOS time.

hwclock --show

This will show the time of the BIOS. If it differes from our System time, lets set it so that it will match. With the command I supply below, the BIOS will get the time from the System time we set above, and will remember it.

hwclock --systohc

Now, we are supposed to be done setting the time. In my case, time was very important, as I wanted to have CRON jobs running on certain times of the day, so it had to be accurate. I hope this small tutorial could help you figure things out about time. Of course, there is much more to this topic, but I didnt have issues further, so I dont discuss them further. You can just read the man pages of hwclock and date. Cheers