Title photo
frugal technology, simple living and guerrilla large-appliance repair
Tue, 27 Nov 2012

Set the Xfce Clock the way you want it

Before:

After:

Using the Clock app in the upper panel of the Xfce 4.8 desktop in Debian Wheezy, I didn't like the stock way date and time was displayed as just time only in the default:

08:23 AM

Luckily when you right-click on Xfce's Clock in the panel, left-click on Properties and choose "Custom Format" under Xfce's Clock options, you can use anything that the Unix/Linux date command switches offer. Go to man date and study up for every single option.

At first, I used the easy %c, which is one of a few options in date that bring a whole lot of information into your clock:

%c
Fri 02 Nov 2012 08:23:27 AM PDT

That's good but not exactly what I wanted. I spent considerable time looking at man date. This is more complicated but gives me output more like I want:

%A, %B %-d, %Y - %-I:%M %p %Z
Friday, November 2, 2012 - 8:23 AM PDT

I now have the full day of the week, full month, 12-hour time and time zone -- all with no "leading zeroes."

Lately I've wanted to save a little space, so I use %b instead of %B:

%A, %b %-d, %Y - %-I:%M %p %Z
Friday, Nov 2, 2012 - 8:23 AM PDT

Explanation: All of these parameters are explained in man date. You use a minus sign to remove the leading zeroes in dates and times when they are in single digits: %-d and %-I instead of %d and %I

Spending some time with man date is the best way to get exactly the output you want in your Xfce (or any other Unix-based) clock application.

Also: If you want to go from 08:23 AM to 8:23 AM -- removing the leading zero, use this:

%-I:%M %p
8:23 AM

I pretty much included this last one so I'll remember it. But if I didn't, man date is my friend.