if [ -n "$1" ] && [ -n "$2" ];then dt=$1 hours=$2 end_time=$dt‘ ‘$hours start_time=`date --date="$end_time 1 hour ago" +"%Y-%m-%d %H"` else start_time=`date --date="1 hour ago" +"%Y-%m-%d %H"` end_time=$(date "+%Y-%m-%d %H") dt=`date --date="1 hour ago" +"%Y-%m-%d"` hours=`date -d "1 hour ago" +%H` fi