in reply to Re^2: User's time
in thread User's time

In your original post, you are using the value returned by the "time" function in perl, which represents seconds since the epoch on the server; you're passing that to localtime, to break it into a set of calendar values.

Assuming you know time-zone offset (relative to the server) for the client who will be reading the page, just add that number of seconds to the output of the time function and pass the result of that to localtime -- something like:

$offset_sec = $timezone_hr_offset *3600; # offset may be negative @time_vals = localtime( time + $offset_sec );

Replies are listed 'Best First'.
Re^4: User's time
by kiat (Vicar) on Oct 16, 2004 at 04:31 UTC
    Thanks, graff!

    It works now :) I didn't know what to do with $offset_set variable earlier. Your solution makes it very clear :)