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.
Domanda
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?
Soluzione
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.
Altri suggerimenti
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.