我有一个要求,我将以以下格式给出时间
2019-02-08T19:24:30.220Z
通过这个我需要输出给定日期和当前日期之间的天数。
给定日期 =2019-02-08T19:24:30.220Z
当前日期 =2019-02-20T19:24:30.220Z
输出 =12
我有一个要求,我将以以下格式给出时间
2019-02-08T19:24:30.220Z
通过这个我需要输出给定日期和当前日期之间的天数。
给定日期 =2019-02-08T19:24:30.220Z
当前日期 =2019-02-20T19:24:30.220Z
输出 =12
使用
ksh93
(通常默认安装在 AIX 或 Solaris 等基于商业 SysV 的 unice 上),这也恰好是/bin/sh
Solaris 11 和更新版本:在 2019-02-20T11:17:30Z 有点,这给了我:
如果要将差异作为整数,则可以使用
$((f(difference_in_24h_periods)))
wheref
is one ofround
,floor
,ceil
,nearbyint
,trunc
,rint
,就像在 C 中一样,或者使用格式规范来指定有效位数。int
printf
与
zsh
: