how to set date and time


8 posts
by mugliett » Thu Aug 02, 2012 10:21 pm
the date and time are set wrong on my raspberry pi does anyone know how to change it and if so could you explain it to me as i have tried and tried and have got nowhere.
Posts: 2
Joined: Thu Aug 02, 2012 10:15 pm
by Joe Schmoe » Thu Aug 02, 2012 11:05 pm
1) How are you trying to do it?

2) Do you have a working Internet connection on the Pi? Is it present & working during the bootup?
Never answer the question you are asked. Rather, answer the question you wish you had been asked.

- Robert S. McNamara - quoted in "Fog of War" -
Posts: 2269
Joined: Sun Jan 15, 2012 1:11 pm
by mihir_s9 » Thu Aug 09, 2012 8:10 pm
hey even i am stuck at the same, no i dont have a working net connection to the pi...may get that in 2-3 days, but till then is there ant other way to set it??
Posts: 1
Joined: Thu Aug 09, 2012 2:38 pm
by andyroyal » Thu Aug 09, 2012 8:34 pm
From a command time, do something like:

Code: Select all
sudo date -s "Thu Aug  9 21:31:26 UTC 2012"


That should sort you out. For more info on the syntax of the date command:

Code: Select all
man date


should tell you everything you need to know.

Remember that the Raspberry Pi doesn't have a real-time clock (unless you add one yourself) so unless you're connected to the internet you'll have to set the time every time you power on or restart.
Posts: 32
Joined: Fri Jul 20, 2012 7:41 pm
Location: Berkshire, UK
by bredman » Thu Aug 09, 2012 9:05 pm
For more examples of how to set the date/time, see the Command Line Clinic in issue 2 of the free MagPi magazine.
www.themagpi.com
Posts: 1413
Joined: Tue Jan 17, 2012 2:38 pm
by Olavxxx » Fri Aug 10, 2012 9:11 am
The Raspberry Pi does not come with a real-time clock,[5] so an OS must use a network time server, or ask the user for time information at boot time to get access to time and date for file time and date stamping. However, a real-time clock (such as the DS1307) with battery backup can be added via the I2C interface.
ref: http://en.wikipedia.org/wiki/Raspberry_Pi

As far as setting it, I did it at the first boot/install screen, while connected to the interwebs.
Posts: 7
Joined: Fri Aug 10, 2012 9:05 am
by sivakumar » Sun Oct 13, 2013 5:57 am
Hello,
If there is internet connection available follow the steps to set the date
1. sudo raspi-config
2. Internationalization options
3. Change Time Zone
4. Select geographical area
5. Select city or region.
6. Reboot your pi.

This way, you will have accurate time. Need not set the date again for every boot.

Warm Regards,
Sivakumar
Posts: 1
Joined: Sun Oct 13, 2013 5:37 am
by bingindo » Thu Jan 30, 2014 3:41 am
sivakumar wrote:Hello,
If there is internet connection available follow the steps to set the date
1. sudo raspi-config
2. Internationalization options
3. Change Time Zone
4. Select geographical area
5. Select city or region.
6. Reboot your pi.

This way, you will have accurate time. Need not set the date again for every boot.

Warm Regards,
Sivakumar



Hi Sivakumar,

That's great, thanks.
btw, do you work with mysql?
thanks.

Cheers,
Bing
User avatar
Posts: 5
Joined: Wed Jan 29, 2014 7:19 am
Location: Indonesia