I'm trying to use $date -u to get UTC time zone. It works fine but how can i set GTM to get a different time zone. For example, how can i complete that command to check GMT+5 or GMT+6 time zone in command line in Linux?

Any idea how can i do it?

有帮助吗?

解决方案

You can set the timezone just for the one call to the date command (without changing the timezone that your system is set to) like so:

TZ=Asia/Calcutta date

Note the space before the date command.

其他提示

Maybe this is the wrong way, but try setting the time zone, then calling date, then unsetting the time zone.

export TZ=Asia/Calcutta
date
unset TZ

There's a small list here of the time zones: Link To Wikipedia.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top