Digital Clock Settings


14 posts
by nounoua » Sat Jan 12, 2013 1:23 am
Hi all,

I've had my Pi for four weeks now, but I haven't been able to properly change the settings of the digital clock in the menu bar/panel. I can open the settings window, but then in the text edit lines to change the settings I get some codes which I don't know what stand for. If I use '%A' I get the date, and '%R' gets me the time in 24 hr format. Is there a way to display both the date, and time in 12-hour format?
Posts: 7
Joined: Sat Dec 29, 2012 5:59 am
by mikef » Mon Jan 21, 2013 4:00 am
Notice in the Digital Clock settings dialog it says: Format codes: man 3 strftime |n for line break

Which means you can find the formatting codes with the man utility. Type: man 3 strftime

This will run the man (manual) utility that display the instructions for the strftime command (format date and time). You can use the same formatting characters in the Clock Format and Tooltip Format input boxes to specify how you want the date and/or time to appear. You can use %n to add a line break to format date/time over more than one line.
Posts: 1
Joined: Mon Jan 21, 2013 2:37 am
by swerve151 » Wed Feb 20, 2013 3:18 am
@Nounoua

%r will give you a 12 hour clock with am/pm indicator
%R will give you a 24 hour clock
%X will give you a 24 hour clock with seconds
%x will give you the date in this format DD/MM/YY
%d will give you the day in number format
%D will give you the date in this format MM/DD/YY
%a will give you the abbreviated day name
%A will give you the full day name
Posts: 1
Joined: Wed Feb 20, 2013 3:08 am
by aberts10 » Sun Jul 27, 2014 3:27 am
i did a 12 hour clock format with this....

%I:%M %p

just set your timezone in raspi with "sudo raspi-config",
then right click the clock and paste it in.
Posts: 15
Joined: Mon Mar 31, 2014 1:57 am
Location: United States
by lgtronik » Sun Nov 15, 2015 7:22 pm
My Digital Clock settings are: %d %h %Y / %X
Posts: 1
Joined: Sun Nov 15, 2015 7:18 pm
by supra » Mon Nov 16, 2015 2:01 am
I set mine %r :)
Posts: 493
Joined: Thu Feb 28, 2013 9:21 am
Location: Ontario, Canada
by IndyPi » Wed Dec 09, 2015 3:51 am
Posts: 1
Joined: Wed Dec 09, 2015 3:49 am
by amnya » Thu May 12, 2016 2:42 pm
I have set mine to:
%a %d.%h.%Y / %I:%M %p

Which translates to:
Thu 12.May.2016 / 05:41 pm
Posts: 1
Joined: Thu May 12, 2016 2:38 pm
by chexbox » Thu May 12, 2016 11:17 pm
On my pi the clock does not count time when the pi is off. It does not fix upon start-up. How do I fix this? :?
Posts: 13
Joined: Thu Apr 28, 2016 11:31 pm
Location: US
by klricks » Fri May 13, 2016 12:16 am
chexbox wrote:On my pi the clock does not count time when the pi is off. It does not fix upon start-up. How do I fix this? :?


The time should be set as soon as the Internet connection is established sometime during the boot process or soon after. If you don't have internet connection then you need a RTC module of some sort with a battery backup.
Go here for my RPi writeup. Basic config, Serial Port add-on etc:
http://blackeagle12.net/Comp/RPi/Rpi.html Click web icon on right side --->
Posts: 3685
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
by Rive » Fri May 13, 2016 1:17 am
mine is "%r" (and if you hoover the mouse over the time it gives date e.g., "Thursday 05/12/2006")
DNPNWO
User avatar
Posts: 586
Joined: Sat Mar 26, 2016 5:21 pm
Location: USA
by chexbox » Fri May 13, 2016 9:05 pm
klricks wrote:
chexbox wrote:On my pi the clock does not count time when the pi is off. It does not fix upon start-up. How do I fix this? :?


The time should be set as soon as the Internet connection is established sometime during the boot process or soon after. If you don't have internet connection then you need a RTC module of some sort with a battery backup.

It still does not work. The date is wrong too. :?:
find me at https://scratch.mit.edu/users/chexbox/
Posts: 13
Joined: Thu Apr 28, 2016 11:31 pm
Location: US
by reltek » Thu Jul 28, 2016 3:41 pm
chexbox wrote:
klricks wrote:
chexbox wrote:On my pi the clock does not count time when the pi is off. It does not fix upon start-up. How do I fix this? :?


The time should be set as soon as the Internet connection is established sometime during the boot process or soon after. If you don't have internet connection then you need a RTC module of some sort with a battery backup.

It still does not work. The date is wrong too. :?:


Raspberry PI is not like your computer tower keeping time even if you shut it down. PI's date and time comes from Your Internet connection and is set at boot-time. That means when you boot up your PI it should already be connected to a NETWORK with Internet Access.

In the event your PI doesn't have Internet Access when it boots up, its time and date doesn't change but starts where it left off when you shut it down. To overcome this shortcoming you need to something like Real-Time-Clock module that you need to connect to your PI's GPIO pins. Then, you need to have a script or a program that will be called at boot time to read the module time and set it to PI's system clock. This doesn't mean date and time will be accurate - even RTC module drifts, which means you need to also update RTC date and time from your PI's System clock once a day or maybe once a week using CRONTAB. It is really helpful to use wiringPI library, if you are going to be doing this.
Posts: 20
Joined: Wed Jan 13, 2016 3:15 pm
by franzsunil » Sun Sep 11, 2016 2:57 pm
Date and time information shown on the panel digital clock area uses the linux strftime format for date and time. Please see http://linux.die.net/man/3/strftime for details.
Posts: 1
Joined: Sun Sep 11, 2016 2:50 pm