0

Example:

If I do

%a %B %y %m %M %S  

It will display

Thu March 16 03 52 33

It displays the time in 24 hour format. I want the 12 hour format instead.

Are there any options I can do to make it display this?

Thu 3/16 1:53PM

2 Answers 2

1

Well, that depends on which taskbar you're using. There's dozens of them.

However, your example seems to be using the strftime syntax, in which...

  • abbreviated weekday (Thu) is %a,
  • month number (03) is %m,
  • month number without leading zeros (3) is %-m,
  • day number (18) is %d,
  • hours (12-hour) are %I,
  • the same without leading zeros are %-d or %-I,
  • minutes are %m,
  • the "AM/PM" sign is %p.

Note that %-x is specific to Linux (glibc), it won't work on other operating systems (even though e.g. BSDs also use strftime).

Also, while in your case this is probably already configured right, for completeness I'll mention that that %p seems to only work if the system locale is set to one that uses a 12-hour clock. (You don't have to change the main LANG setting, just LC_TIME=en_US.UTF-8 is enough. For example, I want the opposite, so I set LC_TIME=en_DK.UTF-8 to get a 24-hour clock while keeping the rest as en_US.UTF-8.)

1

I can't be entirely certain it's the same, but these look like strftime variables. Try the following:

%a %m/%y %k:%M%P

or this which may remove the month padding: (Thanks @grawity)

%a %-m/%y %k:%M%P

Further information: strftime glibc - strftime unix

1
  • In Linux glibc, there are several extensions including %-m for no padding. See the glibc strftime manpage. You'll probably want the same for days and hours. Mar 18, 2016 at 6:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .