cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Etc


Reference














.

os:linux:command:date.html



Linux Commands Cheat Sheet

date : How to use date command in Linux with examples

man date

       FORMAT controls the output.  Interpreted sequences are:
       %d     day of month (e.g., 01)

       %m     month (01..12)

       %Y     year


Example

## 1 day ago
% date -d '1day ago' +%Y%m%d
20151102
%

% date +"%d%m%Y"
03112015
%

% date +"%H:%M"
23:34
%

UNIX timestamp

# date -d "2015-10-1 12:34" +%s
1443702840

unix time → string time

# date --date "@1443702840"
Thu Oct  1 12:34:00 GMT 2015



os/linux/command/date.html.txt · Last modified: 2018/02/09 by admin

Page Tools