Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash 如何在shell脚本中将ISO时间戳转换为unix时间戳?_Bash_Shell_Datetime - Fatal编程技术网

Bash 如何在shell脚本中将ISO时间戳转换为unix时间戳?

Bash 如何在shell脚本中将ISO时间戳转换为unix时间戳?,bash,shell,datetime,Bash,Shell,Datetime,我有来自aws cli的此日期输出“2020-08-13T12:30:00+00:00” 我需要将这个字符串转换为unixtimestamp,并在shell脚本中执行一些计算。 如果计算结果为真,则以相同的格式将+1天添加到该输出中(“2020-08-14T12:30:00+00:00”),否则保持不变 如何将“2020-08-13T12:30:00+00:00”转换为unixtimestamp以及如何在“2020-08-13T12:30:00+00:00”中添加+1天 如何将“2020-08-

我有来自aws cli的此日期输出“
2020-08-13T12:30:00+00:00

我需要将这个字符串转换为unixtimestamp,并在shell脚本中执行一些计算。 如果计算结果为真,则以相同的格式将+1天添加到该输出中(“2020-08-14T12:30:00+00:00”),否则保持不变

如何将“2020-08-13T12:30:00+00:00”转换为unixtimestamp以及如何在“2020-08-13T12:30:00+00:00”中添加+1天

如何将“2020-08-13T12:30:00+00:00”转换为unixtimestamp

date--date'2020-08-13T12:30:00+00:00'+%s
如何在“2020-08-13T12:30:00+00:00”中添加+1天

date——日期“2020-08-13T12:30:00+00:00+1天”

当我用重复的问题回答bash问题时,我得到了大量的反对票(即使我发帖时没有提出重复的问题)。这显然是重复的,所以要做好准备。这对我不起作用:``日期--date'2020-08-13T12:30:00+00:00'+%s日期:无效日期
2020-08-13T12:30:00+00:00'日期--date'2020-08-13T12:30:00+00:00+1天日期:无效日期
2020-08-13T12:30:00+00+1天```