#!/bin/bash
log_date=$(date -d '2 hours ago' "+%F %T")
echo $log_date
start_date=$(date -d '2 hours ago' "+%F %H:00:00")
echo $start_date
starttime=$(date -d "${start_date}" +%s)
echo $starttime
endtime=`expr $starttime + 3600`
echo $endtime
end_date=$(date -d @$endtime "+%F %T")
echo $end_date
转载请注明原文地址:https://ipadbbs.8miu.com/read-14678.html