击:从另一个时区获取日期和时间 [英] Bash: get date and time from another time zone
本文介绍了击:从另一个时区获取日期和时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
结果
我想从一个bash命令另一个时区(UTC-4)的日期和时间,但我不希望其配置为系统的默认TZ。
结果
有一个简单的办法做到这一点?
结果
例如1(电流):
I would want to get the date and time from another time zone (UTC-4) with a bash command, but I don't want to configure it as the default TZ for the system.
Is there a simple way to do it?
E.g 1 (current):
$ date
fri nov 7 13:15:35 UTC 2014
例如2(我需要):
E.g 2 (what I need):
$ date (+ some option for UTC-4)
fri nov 7 09:15:35 UTC 2014
感谢您的时间和答复!
最好的问候
结果
亚历杭德罗·
Best regards
Alejandro
推荐答案
您可以使用
TZ=America/New_York date
如果你想要做的日期计算,你可以使用
or if you want to do date arithmetic you could use
date -d "+5 hours"
这篇关于击:从另一个时区获取日期和时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文