How to get lowercase am/pm in %ICUDateTimeFor% token?

I'm trying to format a date/time (using %ICUDateTimeFor%) like this:

Monday February 3, 2025 at 10:05am

According to the ICU Documentation, that should be this format:

EEEE MMMM d, yyyy 'at' hh:mmb%

I got that from this section of the page:

That chart says a should give me uppercase, and b should be lowercase. But I'm getting uppercase regardless of which format I choose (and how many a or b characters I use). My macro is very simple, just display text with this text:

%ICUDateTimeFor%NOW()%EEEE MMMM d, yyyy 'at' hh:mmb%

And it outputs:

Monday February 3, 2025 at 10:08AM

Based on some testing, I think this is related to locales and standards for displaying AM and PM only in uppercase…right? I worked around it by manually searching/replacing the strings, but that's so barbaric. Is there another approach?

-rob.

You'll hate to hear it, but "works fine here":

So pointing even more at a locale issue.

However -- if aaaaa does give you the lower case a or p that you want, all you're missing is the constant m. So:

As in:

%ICUDateTime%EEEE, MMMM d, yyyy 'at' hh:mmaaaaa'm'%

That will, of course, break for languages that don't use "am" or "pm"...

Well, that's just bizarre. On all three of my Macs here (USA, west coast), a single b gets me uppercase AM/PM … and I've never mucked with any locale settings.

-rob.

What time server do you use in System Settings > General > Date & Time? I'm using time.apple.com; that's about the only thing I can see where maybe it has an effect? There are no other user-visible settings I see that control time formats. Date and numbers, yes, but not times.

-rob.

Ah, but I'm UK...

System Settings -> Language & Region. Set your "Region" to Europe -> United Kingdom -- ignore the restart dialog -- and you'll see the same as me. Set it back to your original and you'll be back to your "wrong" behaviour.

Payback for insisting on spelling "colour" wrong, IMO :wink:

2 Likes

Yep, we spell colour wrong and insist on uppercase AM/PMㅤ…what's next, we won't use metric? Oh, wait.

-rob.

1 Like

I spoke too soon -- my region settings always give lowercase!

So, to be sure of what you get, you could use two calls to ICUDateTime and the (underused, IMO) Text Case meta characters:

%ICUDateTime%EEEE, MMMM d, yyyy 'AT' hh:mm%\L%ICUDateTime%a%\E

...for lower case, and:

%ICUDateTime%EEEE, MMMM d, yyyy 'AT' hh:mm%\U%ICUDateTime%a%\E

...for upper.

3 Likes

Who knew these regions could be so damn controlling. Thanks for the workarounds; I actually changed my mind and just switched to 24 hour time :).

-rob.

2 Likes