The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-05-2006
userking userking is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 5
Lightbulb Timezone using country code and GMT have different result

I am trying to find out the time on different timezone by using the TZ variable.

However, the timezone using the country code is differnet from using the GMT code.

For example:
for HK ,GMT+8
for Japan, GMT+9
for Aus ,GMT+10

so i write the follow script to test on it.
# cat check.sh
d=`TZ=$* date`
echo "Today is `date` ; $* = `echo $d`"#

try some output on below:
Today is Sun Aug 6 06:07:29 HKT 2006 ; Hongkong = Sun Aug 6 06:07:29 HKT 2006
Today is Sun Aug 6 06:07:29 HKT 2006 ; GMT+8 = Sat Aug 5 14:07:29 GMT 2006
Today is Sun Aug 6 06:07:29 HKT 2006 ; Japan = Sun Aug 6 07:07:29 JST 2006
Today is Sun Aug 6 06:07:29 HKT 2006 ; GMT+9 = Sat Aug 5 13:07:29 GMT 2006
Today is Sun Aug 6 06:07:29 HKT 2006 ; Australia/NSW = Sun Aug 6 08:07:29 EST 2006
Today is Sun Aug 6 06:07:29 HKT 2006 ; GMT+10 = Sat Aug 5 12:07:29 GMT 2006

Using the GMT will get a wrong result of time.
Does anyone know what wrong on setting this TZ ?


Thanks

Last edited by userking; 08-06-2006 at 02:25 AM..
  #2 (permalink)  
Old 08-14-2006
tayyabq8's Avatar
tayyabq8 tayyabq8 is offline Forum Advisor  
Moderator
  
 

Join Date: Nov 2004
Location: Bahrain
Posts: 579
I think you need to use "GMT-8" instead of "GMT+8", here is the sample:
Code:
admin@sco1:/home/admin$export TZ=GMT
admin@sco1:/home/admin$date
Mon Aug 14 16:32:36 GMT 2006
admin@sco1:/home/admin$export TZ=GMT-8
admin@sco1:/home/admin$date
Tue Aug 15 00:32:49 GMT 2006
admin@sco1:/home/admin$export TZ=GMT+8
admin@sco1:/home/admin$date
Mon Aug 14 08:34:50 GMT 2006

Regards,
Tayyab
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:33 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0