To display seconds on the Raspberry Pi OS digital clock, you need to modify the clock settings on the taskbar. Here are the steps to achieve that:
- Accessing the Clock Settings: a. Right-click on the clock at the top-right corner of the Raspberry Pi OS desktop. b. From the context menu, select ‘Digital Clock Settings’ or a similar option (the name might vary slightly based on the version of Raspberry Pi OS you’re using).
- Adjusting Clock Format: a. In the Digital Clock Settings window, find the field named ‘Clock Format’ or ‘Format’. b. This field determines how the time is displayed. You’ll typically see some format strings like
%H:%M
which stands for Hour:Minute in 24-hour format. c. To add seconds, modify the string to%H:%M:%S
. The%S
denotes seconds. d. Once done, click ‘OK’ or ‘Apply’ to save the changes. - The digital clock on your taskbar should now display hours, minutes, and seconds.
Note: The format strings are based on the strftime
function format. You can further customize the time and date format using various codes. If you’re interested, you can look up strftime
format codes online for more details.
The strftime
function in the C programming language provides a way to format time and date. It’s used in various systems and software, and many programming languages provide similar functionality based on the C’s strftime
.
Here’s a list of common strftime
codes:
%a
: Abbreviated weekday name (e.g.,Wed
).%A
: Full weekday name (e.g.,Wednesday
).%b
: Abbreviated month name (e.g.,Jan
).%B
: Full month name (e.g.,January
).%c
: Locale’s appropriate date and time representation.%C
: Century (year divided by 100, range 00 to 99).%d
: Day of the month as a zero-padded decimal number (e.g.,01
to31
).%D
: Equivalent to%m/%d/%y
(e.g.,04/08/21
).%e
: Day of the month as a space-padded number (e.g.,1
to31
).%F
: Equivalent to%Y-%m-%d
(e.g.,2021-04-08
).%H
: Hour (24-hour clock) as a zero-padded decimal number (e.g.,00
to23
).%I
: Hour (12-hour clock) as a zero-padded decimal number (e.g.,01
to12
).%j
: Day of the year as a zero-padded decimal number (e.g.,001
to366
).%m
: Month as a zero-padded decimal number (e.g.,01
to12
).%M
: Minute as a zero-padded decimal number (e.g.,00
to59
).%p
: Locale’s equivalent of either AM or PM.%r
: Time in AM or PM notation (e.g.,08:08:08 PM
).%R
: Equivalent to%H:%M
.%S
: Second as a zero-padded decimal number (e.g.,00
to59
).%T
: Equivalent to%H:%M:%S
.%u
: Weekday as a number, where Monday is1
and Sunday is7
.%U
: Week number of the year (Sunday as the first day of the week) as a zero-padded decimal number.%V
: ISO 8601 week number of the year with Monday as the first day of the week.%w
: Weekday as a decimal number, where Sunday is0
and Saturday is6
.%W
: Week number of the year (Monday as the first day of the week).%x
: Locale’s appropriate date representation.%X
: Locale’s appropriate time representation.%y
: Last two digits of the year (e.g.,21
for 2021).%Y
: Full year (e.g.,2021
).%z
: UTC offset in the form+HHMM
or-HHMM
.%%
: A literal%
character.
You can combine these codes in various ways to create custom date and time formats. For example, %A, %B %d, %Y
would produce “Wednesday, April 08, 2021”.