Description:
In this page you will find a comprehensive list of digital clock format strings you may use when changing the display settings for the desktop digital clock on your Raspberry Pi computer.
Each digital clock format string is an upper or lowercase character preceded by the percent sign. Characters not preceded by the percent sign are displayed as entered. The (%%) format string allows for the literal percent (%) character to be displayed. Literal characters may be placed within the digital clock format strings.
Note: Please visit link below for how to change your desktop clock.
Change Clock Format for Raspberry Pi Desktop – Pi With Vic
Example:
Many people prefer a 12-hour clock, and because the desktop clock typically displays a 24-hour clock, one popular digital clock format is shown below:
%I:%M %p
As a result of using this clock format string, if the Time were 9:21 am in the morning the desktop clock would display:
09:21 AM
Digital clock format strings for Week & Day of Week:
- %a – The abbreviated name of the day of the week.
- %A – The full name of the day of the week.
- %u – The day of the week as a decimal, (1 to 7), Monday being 1.
- %w – The day of the week as a decimal (0 to 6), Sunday being 0.
- %U – The week number of current year as a decimal number (00 to 53).
- %V – The ISO 8601-week number.
- %W – The week number of the current year as a decimal number (00 to 53).
- %j – The day of the year as a decimal number (001 to 366).
Digital clock format strings for Day & Month:
- %b – The abbreviated month name.
- %B – The full month name.
- %d – The day of the month as a decimal number (01 to 31).
- %h – Equivalent to %b.
- %m – The month as a decimal number (01 to 12).
- %M – The minute as a decimal number (00 to 59).
Digital clock format strings for Date and Time:
- %c – The preferred date and time representation for the current locale.
- %D – Equivalent to %m/%d/%y. %e – Like %d, the day of the month as a decimal number with leading space.
- %F – Equivalent to %Y-%m-%d (the ISO 8601 date format).
- %x – The preferred date representation without the time.
- %+ – The date and time in date (1) format.
Digital clock format strings for Year:
- %C – The century number (year/100) as a 2-digit integer.
- %G – The ISO 8601 week-based year.
- %g – Like %G, but without century, that is, with a 2-digit year (00–99).
- %y – The year as a decimal number without a century (00 to 99).
- %Y – The year as a decimal number including the century.
Digital clock format strings for Time & Time zone:
- %p – Either “AM” or “PM” according to the given time value.
- %P – Like %p but in lowercase: “am” or “pm”.
- %r – The time in a.m. or p.m. notation.
- %R – The time in 24-hour notation (%H:%M).
- %T – The time in 24-hour notation (%H:%M:%S)
- %H – The hour as a decimal number using a 24-hour clock (00 to 23).
- %I – The hour as a decimal number using a 12-hour clock (01 to 12).
- %k – The hour (24-hour clock) as a decimal number (0 to 23).
- %l – The hour (12-hour clock) as a decimal number (1 to 12).
- %s – The number of seconds since the Epoch, 1970-01-01 00:00:00 +0000.
- %S – The second as a decimal number (00 to 60).
- %X – The preferred time representation without the date.
- %z – The +hhmm or -hhmm numeric time zone (hour & minute offset from UTC).
- %Z – The time zone name or abbreviation.
Special Characters and Modifiers:
- %n – A newline character.
- %t – A tab character.
- %% – A literal ‘%’ character.
Summary:
The Raspberry Pi desktop clock by default usually shows only the time in a 24-hour clock format. Using this list of format strings you now have the power to display the date and time however you would like. Right click on the Raspberry Pi Desktop Clock and select Digital Clock Settings from the popup menu. Modify the Clock Format text field as desired for your new desktop clock.
More Information:
This list of clock format strings was compiled from the manual page for “strftime“. To view the manual page, open the Raspberry Pi Terminal from the desktop type the following command:
man strftime
Notably, the picture below shows the command entered above:
As a result, the following manual page for “strftime” will be displayed as shown below: