Jump to content

Local machine time instead of server time


Twitch

Recommended Posts

Hey guys I'm hoping someone can help me with making this script get the user's local computer time instead of the server time.  I know php can't do it and I know javascript can, but I'm not sure how to do it with this script.  I had another script I was working on that never quite worked, but this one does what I need it to do, but with the server time instead of the local time.

 

Thanks in advance,

Twitch

Whoops I forgot to post the code.  :-[

<?php 

$b = time(); 

$hour = date("g",$b);
$m = date("A", $b);
$d = date("D", $b);

echo $hour;
echo $m;
echo $d;

if ($m == "AM")
{
if ($hour == 12)
{
echo "Good Evening!";
}
elseif ($hour < 4)
{
echo "Good Evening!";
}
elseif ($hour > 3)
{
echo "Good Morning!";
}
}

elseif ($m == "PM")
{
if ($hour == 12)
{
echo "Good Afternoon!";
}
elseif ($hour < 7)
{
echo "Good Afternoon!";
}
elseif ($hour > 6)
{
echo "Good Evening!";
}
}

?>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.