How to set time & date and timezone on UNIHIKER
Soooo how do I set the timezone, time & date on the UNIHIKER and does it have a RTC?
Cheers
Phil.
Use the following three commands in a terminal window (after you have successfully established network connectivity):
timedatectl list-timezones
sudo timedatectl set-timezone <choose from the list of the previous command>
timedatectl
Matha.Goram Thanks LL you explanation fit my problem and a change of timezone resolved the issue.
seanconwayUse this command to set the time:
date -s "2023-10-23 13:45:00"
No joy in mudville. It did not work.
root@unihiker:~# date
Sat 13 Jan 2024 03:12:11 AM CST
root@unihiker:~# date -s "2024-01-12 13:10:00"
Fri 12 Jan 2024 01:10:00 PM CST
root@unihiker:~# date
Sat 13 Jan 2024 03:12:23 AM CST
root@unihiker:~#
I have also tried
date --set="20240111 15:10"
sudo date --set="20240111 15:10"
also tried su - before issuing commands
The reason why using `date -s` to change the time didn't take effect is that there is an NTP service on your Unihiker, and your Unihiker is connected to the network. Therefore, the time will automatically synchronize with the NTP servers on the network.
So if you want to manually set the system time completely by yourself, you need to stop the NTP service. To stop it, use `systemctl stop systemd-timesyncd`. After stopping it, when you run `date -s "2024-01-12 13:10:00"`, the time will no longer be refreshed by the NTP server.
By the way,If your Unihiker has a network connection, I wouldn't recommend stopping the NTP service, as you'd have to reset the time every time you boot up (unless you never shut down). A better approach is to let your Unihiker connect to the network and then set the timezone for your current location. This way, the time will automatically sync to your local time. Here's how you can do it:
```
# First, make sure the NTP service is running
systemctl enable systemd-timesyncd
systemctl start systemd-timesyncd
# Set the timezone
# Use the following command to see the currently set timezone
timedatectl
# Use the following command to list all available timezone names
timedatectl list-timezones
# You can use grep to help find a specific timezone, for example, to see all timezones for America:
timedatectl list-timezones | grep -i america
# Use the following command to set your timezone to New York time
timedatectl set-timezone America/New_York
# Use the command again to check if the setting was successful
timedatectl
# Check the current time
date
```
The time & date reported by my Unihiker is wrong. The device is connected to a network. I can access the device from my computer. I can display the webpage. I cannot change the network setting using the web interface, it tells me the password is wrong. The device is connected to the wifi network because my routers has the mac in its DHCP IP listing.
How can I correct time & date?
seanconwayHi,
UNIHIKER is equivalent to a computer with a Linux system, so it will automatically adjust the time after connecting to the network.
Please check this tutorial about connecting to the network: https://www.unihiker.com/wiki/webmenu
Afra
Afra