i think i got a sweet perl time thing going on, but i can't seem to mix it with the javascript... i need fresh eyes on this...
sweet perl time thing:
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900;
$hour=$hour+$offset;
if ($hour >= 24) {
$hour = $hour - 24;
$mday = $mday + 1;
}
if ($hour >= 12) {
if ($hour > 12){
$hour = $hour - 12;
}
$ampm = "pm";
}
else { $ampm = "am"; }
if ($sec < 10) { $sec = "0$sec"; }
if ($min < 10) { $min = "0$min"; }
if ($mon < 10) { $mon = "0$mon"; }
if ($mday < 10) { $mday = "0$mday"; }
$month = ($mon + 1);
@months = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
my $date = "$months[$mon] $mday $year";
chop($date) if ($date =~ /\n$/);
my $datetime = "$date $hour:$min:$sec";
javascript :
function setup(day,box)
{
today = (new Date()).getTime();
the_day = (new Date(day)).getTime();
time = (the_day - today);
document.forms[box].time2.value=time;
}
I can't seem to force-feed perl (first code block) into the Javascript without busting the timer. UGH.
I tried : "today = $datetime" and some variations..
Hitting a wall!