How to subtract 5 minute from date

前端 未结 2 1769
南笙
南笙 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 15:11

    There's more than one way to subtract a value from the current time, although this should match the format shown in your question:

     date -d "-5 min" "+%Y-%m-%d %H:%M:%S"
    

    Result:

    2015-10-08 15:26:13
    

提交回复
热议问题