Nilesh Parmar wrote:
Using the POSIX string, we can create a timezone called CST that is GMT+6 as follows:
[root@hp-dl120gen9-01 ~]# TZ=:CST6 date Thu Jul 9 06:50:29 CST 2015
TZ=':CST6' uses an implementation-specific extension to POSIX. Often in this case implementations ignore the ':' so it's equivalent to TZ='CST6'. tzcode does that, and I assume glibc does too. With TZ='CST6', the time zone is six hours behind UTC (i.e., west of Greenwich), like this: $ date -u; TZ=CST6 date Wed Jul 29 22:52:44 UTC 2015 Wed Jul 29 16:52:44 CST 2015
But this is not consitent if tzdata package is update.
A TZ setting like 'CST6' is a string specified by POSIX, and should work correctly regardless of what's in tzdata.
Also this does take into account DST change?
TZ='CST6' has no DST. For more about POSIX TZ settings, please see: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_...