Created
August 14, 2016 21:52
-
-
Save gardart/29144df23a995263c0618906013d455a to your computer and use it in GitHub Desktop.
Print out timestamp for each hour between date range
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
#!/bin/bash | |
# Print out timestamp for each hour between date range | |
begin_date=`date +%Y-%m-%d" "%H":00:00" -d "01/01/2016"` | |
end_date=`date +%Y-%m-%d" "%H":00:00" -d "01/30/2016"` | |
while [ "$begin_date" != "$end_date" ] ; | |
do | |
begin_date=`date -d "${begin_date}"'1 hour' +%Y-%m-%d" "%H":00:00"` | |
converted_date=`date -d "${begin_date}" +%Y%m%d%H` | |
echo $converted_date | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment