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

Thanks, Mark :)

I'm not gettng it. How does the changed $time variable get factored into localtime?

Replies are listed 'Best First'.
Re^3: User's time
by graff (Chancellor) on Oct 16, 2004 at 04:23 UTC
    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 );
      Thanks, graff!

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