How to change the Time


12 posts
by DavidDunn » Mon Aug 06, 2012 2:31 pm
Just got my machine and its on UK time. How do I change it? I know it must be simple but....

Many thanks

David
Posts: 4
Joined: Mon Aug 06, 2012 2:26 pm
by james968 » Mon Aug 06, 2012 2:51 pm
If you are using Raspian then there is a utility which allows you to specify the time zone and other setup otptions:
_ /usr/bin/raspi-config

If you are using a debian variation (including raspbian) you can do:
_ sudo dpkg-reconfigure tzdata

(The time is set by contacting an NTP server, so you should have working internet access for it to set the time correctly, its the TZ you need to specify)

thanks
James
Posts: 29
Joined: Tue Jul 17, 2012 8:52 am
by DavidDunn » Mon Aug 06, 2012 3:06 pm
James,

Many thanks. I will try it.

David
Posts: 4
Joined: Mon Aug 06, 2012 2:26 pm
by w.e. williamson jr. » Sun Sep 08, 2013 5:19 pm
Thanks for this post!
Posts: 1
Joined: Sun Sep 08, 2013 5:14 pm
by Hassufel » Sat Feb 22, 2014 8:11 am
Many thanks for this post! For me it was wery useful :D
Posts: 1
Joined: Sat Feb 22, 2014 8:09 am
by real1 » Sun Mar 29, 2015 9:30 am
Thank you for the information, i need to channge the clock on the raspberry pi.
User avatar
Posts: 5
Joined: Tue Jun 04, 2013 4:19 pm
by DougieLawson » Sun Mar 29, 2015 10:30 am
sudo raspi-config
has an option "internationalisation" under that menu there's a "timezone" setting.

Or just use
sudo dpkg-reconfigure tzdata

DO NOT reset the clock with a "date" command.

Four of my RPis switched to British Summer Time automagically. The other is set to stick on UTC/GMT all year round.
Please post technical questions on the forum, not by personal message. Thanks.

Hacker on ZX80, Microtan65, Raspberry Pi & Arduinos
Mainframe Database troubleshooter
MQTT Evangelist
RPi owner since 2012.
Twitter: @DougieLawson

2B, B+, A+, 5Bs, C
User avatar
Posts: 13992
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
by Madvillain » Fri May 01, 2015 5:26 pm
Having a similar issue, when I try sudo dpkg-reconfigure tzdata and change my timezone to 'Europe/London' it doesnt change anything. It still thinks my date and time is "Wed Feb 18 08:36 GMT 2015"

Not really sure how else to change it as I cant browse using Chromium with a wrong date apparently (certificate issues)
Posts: 8
Joined: Tue Apr 28, 2015 7:09 pm
by DougieLawson » Fri May 01, 2015 5:37 pm
What's in /etc/timezone?

What happens if you pick something like "Antarctica/McMurdo", then log out, reboot (optionally), log back in and choose your normal time zone?

Is NTP runnning to set your clock against an internet time server?

What happens if you run
sudo /etc/init.d/ntp stop
sudo ntpd -q -g
sudo /etc/init.d/ntp start
Please post technical questions on the forum, not by personal message. Thanks.

Hacker on ZX80, Microtan65, Raspberry Pi & Arduinos
Mainframe Database troubleshooter
MQTT Evangelist
RPi owner since 2012.
Twitter: @DougieLawson

2B, B+, A+, 5Bs, C
User avatar
Posts: 13992
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
by Madvillain » Fri May 01, 2015 10:23 pm
Nano /etc/timezone = "Europe/London" was changed to "Antarctitica/McMurdo" rebooted and then changed back and no difference. Data is still some random day in February.

service ntp stop - was executed and it stopped the program

Code: Select all
ntpd -q -g
- was executed and it hasnt really done anything. Waited 20 minutes and then pressed CTRL C to cancel it.

I also tried sudo ntpdate-debian and apparently the socket is in use, even when NTP has been stopped ?

Could this be the route of my problem ? As I have no access to the Router Configuration I cant check if the port is blocked.
Posts: 8
Joined: Tue Apr 28, 2015 7:09 pm
by rpdom » Sat May 02, 2015 5:01 am
Does
Code: Select all
ntpq -p

Show anything useful?
User avatar
Posts: 5554
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK
by DougieLawson » Sat May 02, 2015 8:02 am
It's mostly insane Network Admins who block the ports that ntp uses, but it does happen because ntp was a security nightmare once in its chequered history.

If you really can't get ntp running then switch it out for htpdate (http://www.vervest.org). HTPDATE isn't as accurate but it uses the HTTP protocol and any reachable domain to set the time (so bypasses firewalls unless they're extremely restrictive). It pulls a web page and uses the
Code: Select all
Date: Sat, 02 May 2015 07:56:42 GMT
header that's returned. You're relying on a remote website like wikipedia.org to set their clock correctly.

You could set-up your RPi to use www.raspberrypi.org & mirrordirector.raspbian.org (if they're blocked you have other more serious issues with your Network Admin) for the time with htpdate.
Please post technical questions on the forum, not by personal message. Thanks.

Hacker on ZX80, Microtan65, Raspberry Pi & Arduinos
Mainframe Database troubleshooter
MQTT Evangelist
RPi owner since 2012.
Twitter: @DougieLawson

2B, B+, A+, 5Bs, C
User avatar
Posts: 13992
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK