Click to See Complete Forum and Search --> : localtime/date


LJK
08-30-2004, 11:55 PM
Hi -
Been using a great guestbook.cgi script for a while now...only thing I haven't figured out how to 'tweak' is this:

Time/date posted with the messages reflects, of course, the server's time - which is an hour ahead of my time zone.
Any way I can change it to subtract one hour?

$time = localtime($time);

Thanks in advance,
El

Jeff Mott
08-31-2004, 09:39 AM
$time = localtime($time - 3600);

However, there is still a potential problem later on. That is if you ever moved to another server in another time zone then all your dates would once again be incorrect.

Perl also has a gmtime() function, which will return the same time no matter what zone you are in.

LJK
08-31-2004, 12:00 PM
Hi -
Thanks so much for your reply - will change the code and see how it works. Since this is my 'free' space from my ISP, it'll be used for quite awhile!

Much appreciation,
El