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