I have two UTC DateTime strings that I get from GitHub API. The format looks like 2020-09-20T23:25:51Z.
Could someone help me calculate the number of seconds between any given 2 DateTime strings? I can use bash or python 2.7.
I have two UTC DateTime strings that I get from GitHub API. The format looks like 2020-09-20T23:25:51Z.
Could someone help me calculate the number of seconds between any given 2 DateTime strings? I can use bash or python 2.7.
This date format is called ISO-8601
To compute the difference between dates in seconds, you simply convert date to seconds. In shell it is:
date -d '2020-09-20T23:25:51Z' +%s'When you have two dates converted to seconds, it becomes a simple arithmetic problem:
Here exactly 3600 seconds
See also: Shell script to get difference in two dates