Created
November 26, 2020 21:57
-
-
Save pawiromitchel/e74c66351c5584532830787798758314 to your computer and use it in GitHub Desktop.
Calculate datetime difference between 2 dates in #bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Value1=$(TZ=Europe/Amsterdam date "+%F %H:%M:%S") | |
Value2=$(TZ=America/Paramaribo date "+%F %H:%M:%S") | |
Difference=$(($(date -d "$Value1" '+%s') - $(date -d "$Value2" '+%s'))) | |
expr $Difference / 3600 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment