0

I'm working with the date command in Linux and I'm curious about the format specifier "%b". It outputs the abbreviated month name, which is great. However, I couldn't find a clear explanation for why "b" was chosen for this purpose.

In contrast, "%Y" for full year and "%d" for day seem intuitive. Is there a specific reason behind using "b" for abbreviated month, or is it simply a historical convention?

I'd appreciate any insights into the origin or rationale behind this format specifier, Thank you everyone.

3
  • Sometimes, there just aren't enough letters in the alphabet, and both %m and %M were taken. Commented May 21, 2024 at 13:38
  • As date +%m is already taken for numerical month & date +%M for minutes, %bis taken for "brief month" and %B for month Commented May 21, 2024 at 13:39
  • Similar to what Kusalananda and admstg say, but I think they went with alphabetical order (a/A went for day, and then the next was b/B for month). You can even see it in the order in man date - locale day, locale month, locale full date in that order. Commented May 21, 2024 at 14:12

1 Answer 1

-1

it conforms to the ansi c standard (have a look at man strftime). I dont believe that it has a specific reason other than being first available (however I remember it as a'b'reviated month ;-) )

2
  • 1
    ANSI C was adopted in 1989. date was included in Version 1 AT&T UNIX, released 1983. Could you have it backwards and say that ANSI C just adopted was was already in use? Commented May 21, 2024 at 17:53
  • could be! good point Commented May 21, 2024 at 18:35

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.