12hr date

I'm wanting to make the 'date' command be 12hr instead of 24hr - is there a way I could do it? I think %I is the correct 12hr instead of %H - but I don't know where to set it.

Thanks

1 Reply

This is described in man date:

SYNOPSIS
       date [OPTION]... [+FORMAT]

So you would type date, then a + followed by an appropriate format string. As an example:

% date +%I 
08

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct