Peppermint OS Community Forum

Resources => User Submitted Tutorials => Topic started by: VinDSL on November 16, 2016, 06:05:27 pm

Title: XFCE Clock - Custom formatting codes
Post by: VinDSL on November 16, 2016, 06:05:27 pm
Special thanks to Erik_FL @ LinuxQuestions.org (http://www.linuxquestions.org/questions/slackware-14/xfce-clock-custom-formatting-codes-753433/#post3673653)


This information is a little difficult to find and not in the XFCE help (as far as I know). Here are the formatting codes that can be used when setting the XFCE Clock (on the panel) to use a Custom format. Type the codes in the text box along with any other literal text that you want displayed such as colons, periods, etc.

Quote
%%   a literal %
%a   locale's abbreviated weekday name (e.g., Sun)
%A   locale's full weekday name (e.g., Sunday)
%b   locale's abbreviated month name (e.g., Jan)
%B   locale's full month name (e.g., January)
%c   locale's date and time (e.g., Thu Mar  3 23:05:25 2005)
%C   century; like %Y, except omit last two digits (e.g., 21)
%d   day of month (e.g, 01)
%D   date; same as %m/%d/%y
%e   day of month, space padded; same as %_d
%F   full date; same as %Y-%m-%d
%g   last two digits of year of ISO week number (see %G)
%G   year of ISO week number (see %V); normally useful only with %V
%h   same as %b
%H   hour (00..23)
%I   hour (01..12)
%j   day of year (001..366)
%k   hour ( 0..23)
%l   hour ( 1..12)
%m   month (01..12)
%M   minute (00..59)
%n   a newline
%p   locale's equivalent of either AM or PM; blank if not known
%P   like %p, but lower case
%r   locale's 12-hour clock time (e.g., 11:11:04 PM)
%R   24-hour hour and minute; same as %H:%M
%s   seconds since 1970-01-01 00:00:00 UTC
%S   second (00..60)
%t   a tab
%T   time; same as %H:%M:%S
%u   day of week (1..7); 1 is Monday
%U   week number of year, with Sunday as first day of week (00..53)
%V   ISO week number, with Monday as first day of week (01..53)
%w   day of week (0..6); 0 is Sunday
%W   week number of year, with Monday as first day of week (00..53)
%x   locale's date representation (e.g., 12/31/99)
%X   locale's time representation (e.g., 23:13:48)
%y   last two digits of year (00..99)
%Y   year
%z   +hhmm numeric timezone (e.g., -0400)
%Z   alphabetic time zone abbreviation (e.g., EDT)


As an example, I entered this for my Custom clock format:


That's a lower case "L" not a capital "i". The resulting time display looks like this:

Title: Re: XFCE Clock - Custom formatting codes
Post by: perknh on November 16, 2016, 06:41:23 pm
Thank you, VinDSL.  This is helpful.  :)
Title: Re: XFCE Clock - Custom formatting codes
Post by: scifidude79 on November 16, 2016, 07:12:50 pm
Nice tutorial.  I remember having to look up this information we I first started using Peppermint, so this tutorial will definitely come in handy for new people seeking this information.  :)
Title: Re: XFCE Clock - Custom formatting codes
Post by: PCNetSpec on November 16, 2016, 07:55:51 pm
See:
Code: [Select]
man strftime
;)
Title: Re: XFCE Clock - Custom formatting codes
Post by: VinDSL on November 16, 2016, 08:42:33 pm
SSSSShhhhhh !   ;D
Title: Re: XFCE Clock - Custom formatting codes
Post by: perknh on November 16, 2016, 09:03:59 pm
Good one, guys.  Peppermint forum keeps us on our toes!  ;)

My next stage in my Linux education will be to learn about manual pages.  I know so little about them (https://en.wikipedia.org/wiki/Man_page).
Title: Re: XFCE Clock - Custom formatting codes
Post by: zebedeeboss on November 16, 2016, 09:47:21 pm
Hi All

I always used this site...

http://www.foragoodstrftime.com/ (http://www.foragoodstrftime.com/)

Regards Zeb...
Title: Re: XFCE Clock - Custom formatting codes
Post by: PCNetSpec on November 17, 2016, 06:36:02 am
That's a pretty handy site Zeb :)
Title: Re: XFCE Clock - Custom formatting codes
Post by: mracz on November 19, 2016, 03:39:23 am
To give some colors to your precious time

Code: [Select]
<span foreground="white">%R</span>%n<span foreground="white">%m-%d</span>

Copy this to Clock options format in panel settings.
Title: Re: XFCE Clock - Custom formatting codes
Post by: PCNetSpec on November 19, 2016, 10:08:42 am
Or even change the font
Code: [Select]
<span foreground="#F7E0E1" font_desc="vibrocentric bold italic 13">%R </span>
or
Code: [Select]
<span foreground="#F7E0E1" font_desc="vibrocentric bold italic 13">%R </span>  <span foreground="#F7E0E1" font_desc="vibrocentric bold italic 13">%d %b</span>
(for all of us that don't like the confusion caused by having our day/month backwards :D )
Title: Re: XFCE Clock - Custom formatting codes
Post by: VinDSL on November 19, 2016, 11:02:05 am
Oh, my !   :o

I didn't realize XFCE4 was using Pango for markup in the panel.  Nicceee !

Once again, the gift that keeps on giving ...
Title: Re: XFCE Clock - Custom formatting codes
Post by: PCNetSpec on November 19, 2016, 11:04:09 am
:) Zactly
Title: Re: XFCE Clock - Custom formatting codes
Post by: VinDSL on April 14, 2018, 11:54:31 pm
UPDATE

Been using these settings for awhile - might as well document them:

Appearance
    Layout: Digital
    Tooltip Format: Custom Format
Code: [Select]
%A, %B %d, %Y

Clock Options
    Format: Custom Format
Code: [Select]
<span foreground="#F7E0E1" font_desc="11.3">%l:%M:%S %p</span>
Title: Re: XFCE Clock - Custom formatting codes
Post by: stevesveryown on April 15, 2018, 09:36:52 am
Amazing how the simple things in life keep us happy.  :)
I'll have to play around with some of the sweet suggestions here.

In the meantime, I do mine:
Code: [Select]
%A, %B %d, %Y @ %l:%M %p

I have 3 panels at my top and the clock is in the middle panel with my weather update right next to it.
Title: Re: XFCE Clock - Custom formatting codes
Post by: mac on May 10, 2018, 11:06:33 pm
A belated thanks, Vin.   ;)
Title: Re: XFCE Clock - Custom formatting codes
Post by: alynur on July 07, 2018, 01:07:20 am
Are these codes good for P9? How do I get to where I can make the changes for 12 hour clock?
Title: Re: XFCE Clock - Custom formatting codes
Post by: zebedeeboss on July 07, 2018, 01:27:11 am
Hi alynur,

for a simple 12 hour clock use a custom format of %r

However for me this is annoying as 5:50 pm will display as 05:15  pm

That is why I use %l in my time codes  so  %l:%M %P   will give you 5:15 pm or earlier 5:15 am (that is a lower case L but the : might make it look like a capital L)

Hope this helps

Regards Zeb...
Title: Re: XFCE Clock - Custom formatting codes
Post by: alynur on July 07, 2018, 01:37:33 am
Hi alynur,

for a simple 12 hour clock use a custom format of %r

However for me this is annoying as 5:50 pm will display as 05:15  pm

That is why I use %l in my time codes  so  %l:%M %P   will give you 5:15 pm or earlier 5:15 am (that is a lower case L but the : might make it look like a capital L)

Hope this helps

Regards Zeb...

Hi Zeb, almost. I still don't know where to make those changes or how to get there.
Title: Re: XFCE Clock - Custom formatting codes
Post by: zebedeeboss on July 07, 2018, 01:39:40 am
My bad.

right mouse click the clock and select properties - you should then get this - this is my setup

(https://i.imgur.com/UQ9USII.png)

Regards Zeb...
Title: Re: XFCE Clock - Custom formatting codes
Post by: AndyInMokum on July 07, 2018, 06:33:26 am
Hi All

I always used this site...

http://www.foragoodstrftime.com/ (http://www.foragoodstrftime.com/)

Regards Zeb...

Me too.  It makes a splendid SSB  ;).
Title: Re: XFCE Clock - Custom formatting codes
Post by: alynur on July 07, 2018, 02:39:19 pm
Thanks Zeb, got it! I had checked the web site but I was still at a loss as to where to make those changes. At the moment, my clock reads "Jul 7, 1:38 PM".   ;D
Always something new to learn.
Title: Re: XFCE Clock - Custom formatting codes
Post by: roka on April 16, 2019, 05:36:28 pm
I use time with seconds, but secunds shifting icons (volume, conection...) how to fiks
Title: Re: XFCE Clock - Custom formatting codes
Post by: PCNetSpec on April 16, 2019, 06:59:07 pm
Are you using a custom format ?

Can you provide us with a screenshot of the clock settings ?

Here's how to post an image on this forum
https://forum.peppermintos.com/index.php/topic,4284.0.html

Or here's a great tutorial video by emegra:-

https://www.youtube.com/watch?v=us4rG5UUHmE
Title: Re: XFCE Clock - Custom formatting codes
Post by: clatterfordslim on April 28, 2019, 02:29:36 pm
Or even change the font
Code: [Select]
<span foreground="#F7E0E1" font_desc="vibrocentric bold italic 13">%R </span>
or
Code: [Select]
<span foreground="#F7E0E1" font_desc="vibrocentric bold italic 13">%R </span>  <span foreground="#F7E0E1" font_desc="vibrocentric bold italic 13">%d %b</span>
(for all of us that don't like the confusion caused by having our day/month backwards :D )

Absolutely brilliant and with the full antialiasing in your fonts and change the size to 17 instead of 13 it looks really cool, thank you Mark, did not know you could do this. God I love Peppermint.  :)
Title: Re: XFCE Clock - Custom formatting codes
Post by: VinDSL on April 28, 2019, 03:21:06 pm
Just don't do this...  :D

Whiskey Menu Panel Button (Title)
<span foreground="#FFF" font_desc="cantarell bold 10.3">Apps</span>
[close]

Clock Tooltip Format (Custom)
%A, %B %d, %Y
[close]

Clock Options Format (Custom)
<span foreground="#F7E0E1" font_desc="cantarell bold 10.3">%l:%M:%S %p</span>
[close]

Appsaphobia...   >:(
Title: Re: XFCE Clock - Custom formatting codes
Post by: VinDSL on April 28, 2019, 03:28:09 pm
A belated thanks, Vin.   ;)

OMG! That's making me all weepy...  :'(


Title: Re: XFCE Clock - Custom formatting codes
Post by: Johan on June 26, 2019, 07:42:00 am
solved ;)