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:%Mwhich stands for Hour:Minute in 24-hour format. c. To add seconds, modify the string to
%Sdenotes 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.
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
Here’s a list of common
%a: Abbreviated weekday name (e.g.,
%A: Full weekday name (e.g.,
%b: Abbreviated month name (e.g.,
%B: Full month name (e.g.,
%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.,
%D: Equivalent to
%e: Day of the month as a space-padded number (e.g.,
%F: Equivalent to
%H: Hour (24-hour clock) as a zero-padded decimal number (e.g.,
%I: Hour (12-hour clock) as a zero-padded decimal number (e.g.,
%j: Day of the year as a zero-padded decimal number (e.g.,
%m: Month as a zero-padded decimal number (e.g.,
%M: Minute as a zero-padded decimal number (e.g.,
%p: Locale’s equivalent of either AM or PM.
%r: Time in AM or PM notation (e.g.,
%R: Equivalent to
%S: Second as a zero-padded decimal number (e.g.,
%T: Equivalent to
%u: Weekday as a number, where Monday is
1and Sunday is
%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 is
0and Saturday is
%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.,
%Y: Full year (e.g.,
%z: UTC offset in the form
%%: A literal
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”.