wiki:tipps_und_tricks:mit_datum_rechnen

barcode

Wie kann man mit dem Datum rechnen?

Beispiele

Hier einige Beispiele

date -d "2010-02-04 11:00:00 20 minutes ago" '+%Y-%m-%d %H:%M:%S'
date -d "2010-02-04 11:00:00 120 hours ago" '+%Y-%m-%d %H:%M:%S'
date -d "2010-02-04 11:00:00 120 days ago" '+%Y-%m-%d %H:%M:%S'
date -d "2010-02-04 11:00:00 3 months ago" '+%Y-%m-%d %H:%M:%S'
date -d "2010-02-04 11:00:00 30 years ago" '+%Y-%m-%d %H:%M:%S'
date -d "last month" +%m
date -d "2 month ago" +%b
date -d "-2 month" +%B
date -d "-1 hours" +%H
date -d "tomorrow"
date -d "yesterday" +"%d %B %y"
date -d "last week" +%a

Unix Timestamp

unix → Human:

date +%s

Human → unix:

date -d @<unixtime>

Quellen

Geben Sie Ihren Kommentar ein. Wiki-Syntax ist zugelassen:
  ____    ___   ____    ___   _____
 / __ \  / _ \ / __ \  / _ \ / ___/
/ /_/ / / , _// /_/ / / // // (_ / 
\___\_\/_/|_| \____/ /____/ \___/
 
  • wiki/tipps_und_tricks/mit_datum_rechnen.txt
  • Zuletzt geändert: 2019/10/25 11:26
  • von wikiadmin