|Pathologically Eclectic Rubbish Lister|
Re: Display clockby chanio (Priest)
|on Sep 14, 2005 at 19:00 UTC||Need Help??|
<UPDATED> You should write your code into a $scalar variable and first have your $REPLACE_WITH..._DATE loaded with your desired date (with the scalar localtime function). See the following one-liner (you can try it, first)...
Try it several times and you'll see that it changes to your actual date!
You could do it better, for sure! But this simply shows how you could have the same format as the one needed for the js new Date() format...
Why using such a horrible and long variable instead of writing the time? Because you are going to run the cgi script every time that a new user calls it. So you should display the actual server's time, and not the old one, Ok?
If you need more acuracy, you should use:scalar localtime(time + $elapsed_seconds), where $elapsed_seconds would have the time that elapsed from the time when the server sends the html page to the time when the user sees it :). (TODO: read about perldoc POSIX and perldoc -f localtime)