[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] changing the time returned by localtime



Jakal,

You could get the client to pass the details you need using JavaScript and a form,
heres a little fragment :-

<HTML>
<HEAD>
</HEAD>
<FORM>
<script language="JavaScript">
<!--
var today = new Date();
var now   = new Date();
var zone = today.getTimezoneOffset();
var mins = today.getMinutes();
var hours = today.getHours();
var day = today.getDay();
this.document.write("Local Date <INPUT TYPE=TEXT NAME=LOCALDATE VALUE=\"" + today + "\">");
// -->
</script>
</FORM>
</BODY>
</HTML>

You would obviously change the input type to hidden !
Be warned I have found getTimezoneOffset to behave strange for Australia !

> Is there a simple way of changing the time returned by localtime;
>
> I am currently using $time = localtime(time); to get the time, which is then output using print "$time"; and gives me something like "Mon Jan 17 06:44:52 2000".
>
> which is the correct time according to the Australian server that it is running on. The problem however is that almost all the users of the CGI which generates the time will be in Europe, and it would make more sense for the time to be about 10 hours ahead (or behind, I can't remeber at the moment). Is there any easy one to do this?
>
> Thanks,
>
> Jake
>
> # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org

REGARDS
Paul


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org