in reply to Re: Re: How to get TZ difference?
in thread How to get TZ difference?

This is a little shorter and more confusing.
@local=(localtime(time+$off_h*60*60)); @gmt=(gmtime(time+$off_h*60*60)); $diff=$gmt[2]-$local[2] + ($gmt[5] <=> $local[5] || $gmt[7] <=> $local[7])*24;

Replies are listed 'Best First'.
Re: Re: Re: Re: How to get TZ difference?
by dda (Friar) on Jul 06, 2003 at 06:38 UTC
    Hi,

    Thanks for your idea. But let me ask you what is $off_h here? And I found that correct result occurs when I subtract $gmt[2] from $local[2]:

    $diff=$local[2]-$gmt[2] + ($gmt[5] <=> $local[5] || $gmt[7] <=> $local[7])*24;

    --dda