Date: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 7: Line 7:
=Overview=
=Overview=


<pre>
<syntaxhighlight lang='bash'>
date +'%m/%d/%y %H:%M:%S'
date +'%m/%d/%y %H:%M:%S'
</pre>
</syntaxhighlight>


Output:
Output:


<pre>
03/07/11 16:07:17
03/07/11 16:07:17
 
</pre>
=Output Patterns=
 
%s seconds since epoch (?)


=AM/PM=
=AM/PM=

Revision as of 17:15, 20 September 2019

External

Internal

Overview

date +'%m/%d/%y %H:%M:%S'

Output:

03/07/11 16:07:17

Output Patterns

%s seconds since epoch (?)

AM/PM

date +'%m/%d/%y %I:%M:%S %p'

Year

Short year (14) %y

Long year (2014) %Y

File Name Format

date +'%y.%m.%d-%H.%M.%S'

Setting Date and Time

date 08311650

sets the date for 08/31 current year, time 16:50.

Getting the Time in Seconds

date '+%s'

Elapsed Time in Seconds

Also see https://home.feodorov.com:9443/wiki/Wiki.jsp?page=Expr