Bash datetime: Difference between revisions

From wikinotes
 
(No difference)

Latest revision as of 23:24, 11 May 2018

WARNING:

Date is not a feature of bash, but part of the gnu or bsd coreutils. That means that it is not as portable as you might like.

date parsing

gnu-coreutils

date -d "2 days ago"
date -d "thursday"
date -d "last thursday"

bsd-coreutils

date formatting

gnu-coreutils

date '+%d/%m/%Y %H:%M:%S'  #> 01/09/2018 10:00:00

bsd-coreutils