How to subtract 5 minute from date

前端 未结 2 1777
南笙
南笙 2021-01-22 14:29

I have this data:

`date +%Y-%m-%d`\" 00:00:00\"

that return 2015-10-08 00:00:00

I would like cancel 5 minute:



        
2条回答
  •  悲&欢浪女
    2021-01-22 14:59

    You need to subtract 5 minutes from a known point in time:

    $ date -d "00:00:00 today"
    Thu Oct  8 00:00:00 EDT 2015
    $ date -d "00:00:00 today -5 minutes"
    Wed Oct  7 23:55:00 EDT 2015
    

    You just need to add your format string.

提交回复
热议问题