Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top