Time and Date Desklet

UUID: TimeAndDate@nightflame
Last edited:
4 weeks ago 2020-09-02, 03:09
Last commit: [dfc7955e] Added Korean language file

A fork desklet that displays the time and date

README

Close

Time and Date Cinnamon Desklet v0.1 - 19 June 2013

This is a simple desklet to display the time and date. The size and format of the date are configurable by changing the values in metadata.json. This can be launched from the Desklet itself by selecting Config from the menu.

Adjust the following paramters in the metadata.json file which is stored in ~/.local/share/cinnamon/desklets/TimeAndDate@nightflame:

"timeFormat": "%H:%M",
"timeSize": "50pt",
"dateFormat": "%A,%e %B",
"dateSize": "25pt"

REMEMBER TO LEAVE THE COMMAS IN - except for the last line!

The time and date format are from JavaScript toLocaleFormat function, and the possible values can be found at:

http://pubs.opengroup.org/onlinepubs/007908799/xsh/strftime.html

For exmple to add seconds change timeFormat to:

"timeFormat": "%H:%M:%S",

After changing the settings you need to remove and re-add the Desklet

If I knew what I was doing I would update the config through the GUI. Maybe next version.

-Steve desklets [at] stargw [dot] eu

Log In To Comment!

20 Comments

paulkeenan523
paulkeenan523-1 week ago
Trying to get the time and date permanently displayed on browser. Any way to display your extension on top of other aps? TIA for any feedback.
lejuans01
lejuans01-3 weeks ago
https://www.lifewire.com/display-date-time-using-linux-command-line-4032698 hope this helps Display the date using any or all of the following elements: %a: abbreviated day name (i.e. mon, tue, wed) %A: full day name (i.e. Monday, Tuesday, Wednesday) %b or %h: abbreviated month name (i.e. jan, feb, mar) %B: full month name (January, February, March) %c: locales date and time (full date and time) %C: short year (i.e 14, 15, 16) %d: day of month (i.e. 01, 02, 03) %D: same as M/D/Y (i.e. 04/20/16) %e: day of month padded (i.e. ' 1', ' 2') %F: full date, same as yyyy-mm-dd %H: hour (00, 01, 02, 21, 22, 23) %I: hour (1,2,3,10,11,12) %j: day of year (i.e. 243) %k: hour padded (i.e. '1' becomes ' 1') %l: hour padded (12 hour clock) %m: month number (1,2,3) %M: minute (1,2,3,57,58,59) %n: new line %N: nanoseconds %p: AM or PM %P: like %p but lowercase (ironically) %r: locales 12 hour clock time %R: 24 hour version of hour and minute %s: seconds since 1970-01-01 00:00:00 %S: second (01,02,03, 57, 58, 59) %t: a tab %T: time same as %H:%M:%S %u: day of week (1 is Monday, 2 is Tuesday etc) %U: week number of year (assuming Sunday as first day of the week) %V: ISO week number with Monday as the first day of the week %w: day of week (0 is Sunday) %W: week number of the year with Monday as the first day of the week %x: locales date representation (12/31/2015) %X: locales time representation (14:44:44) %y: last two digits of year %Y: year %z: numeric time zone (i.e. -0400) %:z: numeric time zone as follows (i.e. -04:00) %::z: numeric time zone as follows (i.e. -04:00:00) %Z: alphabetic time zone abbreviation (GMT) - -: a single hyphen prevents zero padding _: a single underscore pads with spaces 0: pads with zeroes ^: use uppercase if possible #: use opposite case if possible To display just the time use the following: date +%T Alternatively, use the following: date +%H:%M:%S Attach the date, as well, using the command: date +%d/%m/%Y%t%H:%M:%S Use any combination of the above switches after the plus symbol to output the date as you so wish. If you want to add spaces you can use quotes around the date. date +'%d/%m/%Y %H:%M:%S' How to Show the UTC Date View the UTC date for your computer using the following command: date -u If you are in the UK you will notice that instead of showing "18:58:20" as the time it will show "17:58:20" as the time. How to Show the RFC Date View the RFC date for your computer using the following command: date --rfc-2822 This displays the date in the following format: Wed, 20 Apr 2018 19:56:52 +0100 This flag is useful as it shows that you are an hour ahead of GMT. Some Useful Date Commands Do you want to know the date next Monday? Try this: date -d "next Monday" At the point of writing this returns "Mon 25 Apr 00:00:00 BST 2016" The -d basically prints a date in the future. Using the same command you can find out which day of the week your birthday or Christmas falls upon. date -d 12/25/2016 The result is Sun Dec 25. Summary It is worth checking out the manual page for the date command using the following command: man date
dcardinale15
dcardinale15-2 months ago
Hi, I am trying to add am or pm. I tried adding :%p, after the :%M but it doesn't like it. I am still a noob so I would appreciate any help. Thanks all
lejuans01
lejuans01-3 weeks ago
{ "last-edited": 1599034184, "description": "A fork desklet that displays the time and date", "prevent-decorations": false, "uuid": "TimeAndDate@nightflame", "name": "Time and Date Desklet", "timeFormat": "%I:%M:%P", "timeSize": "40pt", "dateFormat": "%A,%e %B", "dateSize": "15pt" }
Benjamin Fenigsohn
Benjamin Fenigsohn-4 months ago
How to change the font size? I edited metadata.json, removed, then readded it and it's still the same size but changed in metadata.json.
dcardinale15
dcardinale15-2 months ago
apparently you need to log out and then back in for the changes to take effect. I have been just rebooting and I get that result
aadityalr123
aadityalr123-4 months ago
How can I modify this to display the number of days/hours/minutes from the start of a particular day?
fluntelion
fluntelion-8 months ago
When I want or need to change the color of the time and date display, I have to go a long way: /home/NAME/.local/share/cinnamon/desklets/TimeAndDate@nightflame/stylesheet.css. Whew! It is of course possible to add stylesheet.css as a bookmark in nemo, but it would be much more comfortable if you could add direct access to that file in the right-click menu. Would you do that? For me, and for everybody else, too? :-) Thank you for your attention.
crazymindstorm
crazymindstorm-11 months ago
hi is there a way to change the color of the desklet ?
Kashif Anwaar
Kashif Anwaar-1 year ago
For those who want to change it to 12 hour, change this in config = "timeFormat": "%l:%M", Good job, but changes in config requires restart.
Steven Martin
Steven Martin-1 year ago
Oddly, changing the metadata.json file makes no change to the Desklet, even after removing and restarting the clock. Is there some other trick?
Chris
Chris-1 year ago
I had to log out and then log back in for my changes in metadata.json to take place
marcositz
marcositz-1 year ago
Simple and functional. Perfect! Thank you!
83c577nbybd8zb
83c577nbybd8zb-1 year ago
any way to make it completely transparent? or change the background color?
marcositz
marcositz-1 year ago
Desklets> General Settings> No decoration
Nir Regev
Nir Regev-2 years ago
Nice one, thanks !
Mahesh Mankar
Mahesh Mankar-3 years ago
Is there any way to change color of text? I need date in another color.
Diego Gargaglione
Diego Gargaglione-3 years ago
Nice and useful. Is there any way to change the font?
Kevin Waite
Kevin Waite-3 years ago
Love it!!! I removed the one i was using from Cairo-dock as it did not respect the font sizes for date. This one does Thank you very much.
Olivier Brouillard
Olivier Brouillard-3 years ago
Simple, well designed and efficient. Thanks.