Linux 如何从给定的时间中减去分钟?

Linux 如何从给定的时间中减去分钟?,linux,date,ubuntu,Linux,Date,Ubuntu,我有一个给定的时间字符串14:00,想减去5分钟。 如何在bash中实现这一点 给我一个datetime对象:date-d“14:00”+“%H:%M”->14:00 我尝试过减法:date-d“14:00-5分钟”+“%H:%M” ->给出21:01。但是为什么呢 当然,如果所需结果是:13:55来自gnu日期的信息页面: Our units of temporal measurement, from seconds on up to months, are so comp

我有一个给定的时间字符串
14:00
,想减去5分钟。 如何在bash中实现这一点

给我一个datetime对象:
date-d“14:00”+“%H:%M”
->
14:00

我尝试过减法:
date-d“14:00-5分钟”+“%H:%M”
->给出
21:01
。但是为什么呢


当然,如果所需结果是:
13:55

来自gnu日期的信息页面:

     Our units of temporal measurement, from seconds on up to months,
     are so complicated, asymmetrical and disjunctive so as to make
     coherent mental reckoning in time all but impossible.  Indeed, had
     some tyrannical god contrived to enslave our minds to time, to make
     it all but impossible for us to escape subjection to sodden
     routines and unpleasant surprises, he could hardly have done better
     than handing down our present system.  It is like a set of
     trapezoidal building blocks, with no vertical or horizontal
     surfaces, like a language in which the simplest thought demands
     ornate constructions, useless particles and lengthy
     circumlocutions.  Unlike the more successful patterns of language
     and science, which enable us to face experience boldly or at least
     level-headedly, our system of temporal calculation silently and
     persistently encourages our terror of time.

—Robert Grudin, ‘Time and the Art of Living’.

更相关的是:

The time may alternatively be followed by a time zone correction,
expressed as ‘SHHMM’, where S is ‘+’ or ‘-’, HH is a number of zone
hours and MM is a number of zone minutes
您执行算术的尝试失败,date正在尝试将表达式“-5min”解析为时区更正

以下工作:

$ date -d "14:00 5 minutes ago" +'%H:%M'
13:55
但我无法解释为什么