我想将startTime作为当前时间的开始(例如当前时间是12:55 pm(,然后startTime
将是12:00:00
,endTime将是12:59:59.
我尝试使用startTime="$(date +'%H:%M:%S')"
,但这是根据UTC时间格式给出的时间,即:07:25:43
。但我想要根据我当地的时区得出结果。区域为"+0530"。
在运行date
之前,您需要导出TZ,如:
export TZ=Asia/Kolkata
startTime="$(date +'%H:%M:%S')"
或者在一行中:
startTime="$(TZ=Asia/Kolkata date +'%H:%M:%S')"