LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   XFCE Clock - Custom formatting codes (http://www.linuxquestions.org/questions/slackware-14/xfce-clock-custom-formatting-codes-753433/)

Erik_FL 09-07-2009 07:45 PM

XFCE Clock - Custom formatting codes
 
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.

Code:

%%  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.

%l:%M %p

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

8:44 PM

abrouwers 09-07-2009 09:13 PM

Hm, that's funny - these look VERY similar to my "man strftime" . :)

eerok 09-07-2009 09:16 PM

Or even the "man date" page ... :)

Even fancier date format help can be found with:
Code:

$ info coreutils 'date invocation'

Erik_FL 09-08-2009 12:06 AM

Quote:

Originally Posted by abrouwers (Post 3673714)
Hm, that's funny - these look VERY similar to my "man strftime" . :)

If that's true it would be nice for the XFCE help to have one sentence that says "Refer to ANSI C strftime() for the Custom Clock formatting codes". I'm a n00b to Linux and don't usually know what "everyone" knows. I did honestly try to find the information in the XFCE help and online. The place where I found the formatting information didn't mention "strftime()".

eerok 09-08-2009 02:32 AM

You're right. The Xfce docs should at least refer to where the information on Linux date formats can be found. This isn't Xfce information in particular ... it's general Linux stuff, which makes it harder to find in Xfce-centric searches.

catkin 09-08-2009 03:00 AM

Quote:

Originally Posted by Erik_FL (Post 3673653)
Here are the formatting codes that can be used when setting the XFCE Clock (on the panel) to use a Custom format.

Thank you for posting the information for the community's benefit (even if the *n*xperts already know what to do!)

nwe2023 11-02-2009 09:05 AM

Eric, I just wanted to add my thanks. When I wanted to change the clock codes on my Slackware/Xfce laptop, all I knew was that I needed to know more about Xfce clock codes. So I did a Google search on "xfce clock codes". Give it a try; see what pops up as the first result. I certainly would never have known to look for a manual page on strftime, whatever that is. I think some of the most experienced Linux experts have forgotten how much they did not know when they first started using Linux. So thanks, and thanks to all the subject experts out there who have posted their expertise on this an other forums. We are completely MS-free at my small business, and it would not have been possible without this community.

catkin 11-02-2009 11:18 AM

Quote:

Originally Posted by eerok (Post 3673943)
You're right. The Xfce docs should at least refer to where the information on Linux date formats can be found. This isn't Xfce information in particular ... it's general Linux stuff, which makes it harder to find in Xfce-centric searches.

The xfce4-datetime-plugin (Orage clock) does say, in its configuration window, that it uses strftime and lists 10 commonly used strftime codes.

BTW, the Orage clock always shows the date whereas the standard Xfce clock only shows the date on mouse-over.

vtel57 11-09-2009 09:03 PM

COPIED! Thank you! :)

cmc 06-03-2012 07:52 PM

I understand the codes to type in, I just don't know where to type them.

TommyC7 06-03-2012 08:28 PM

No clue why you bumped a 3 year old thread, but here you go:

1) Right click the clock in xfce4-panel
2) Click Properties
3) Under clock options, you should see your clock with a drow-down menu, click "Custom"
4) Type in whatever you want as the original poster referenced.

intotheunknown 01-19-2014 05:44 PM

A HUGE thank you for posting these codes. Was having a hard time finding a way to change the 24 hour clock to am/pm. Got it working now. YEA! Bookmarked for future reference.

baldheaded-yeti 01-19-2014 09:41 PM

Quote:

Originally Posted by intotheunknown (Post 5101087)
A HUGE thank you for posting these codes. Was having a hard time finding a way to change the 24 hour clock to am/pm. Got it working now. YEA! Bookmarked for future reference.

Same here...the same goes for JVM as well.

mreschke 07-29-2014 02:04 PM

Remember it accepts HTML too!! Helpful because it's the only way to change the color. A great clock format is

<span color="#ffffff">%a %m-%B %d%n%I:%M %p</span>


Tue 07-July 29
02:03 PM


All times are GMT -5. The time now is 11:10 PM.