Script: file dategen.sh
#!/bin/bash _g_DT="$1" _g_TM="$2" _DT=`date -d "$_g_DT $_g_TM" +"%Y%m%d %H"` echo "For: $_DT" for i in `seq 0 5`; do _DT_gen=`date -d "$_DT +$i hours" +"%Y-%m-%dT%H:00"` echo -e "\t$_DT_gen" done
E.g with Sep 30, at 23 hours
bash dategen.sh "2014-09-30" "23" For: 20140930 23 2014-09-30T23:00 2014-10-01T00:00 2014-10-01T01:00 2014-10-01T02:00 2014-10-01T03:00 2014-10-01T04:00