PHP Timezone Help?! Please...........?

  • Thread starter Thread starter Big B
  • Start date Start date
B

Big B

Guest
How Can I get this php time script to display the time in eastern time us cause the server is located in central but I need it to be in eastern

<?php $b = time (); print date("h:i A T",$b) . "";?>
 
I'll give you this script.. you can continue off of it.
function get_formatted_timediff ($then, $now = false)
{
$now = (!$now ? time () : $now);
$timediff = $now - $then;
$weeks = (int)intval ($timediff / INT_WEEK);
$timediff = (int)intval ($timediff - INT_WEEK * $weeks);
$days = (int)intval ($timediff / INT_DAY);
$timediff = (int)intval ($timediff - INT_DAY * $days);
$hours = (int)intval ($timediff / INT_HOUR);
$timediff = (int)intval ($timediff - INT_HOUR * $hours);
$mins = (int)intval ($timediff / INT_MINUTE);
$timediff = (int)intval ($timediff - INT_MINUTE * $mins);
$sec = (int)intval ($timediff / INT_SECOND);
$timediff = (int)intval ($timediff - $sec * INT_SECOND);
$str = '';
if ($weeks)
{
$str .= intval ($weeks);
$str .= (1 < $weeks ? ' weeks' : ' week');
}

if ($days)
{
$str .= ($str ? ', ' : '');
$str .= intval ($days);
$str .= (1 < $days ? ' days' : ' day');
}

if ($hours)
{
$str .= ($str ? ', ' : '');
$str .= intval ($hours);
$str .= (1 < $hours ? ' hours' : ' hour');
}

if ($mins)
{
$str .= ($str ? ', ' : '');
$str .= intval ($mins);
$str .= (1 < $mins ? ' minutes' : ' minute');
}

if ($sec)
{
$str .= ($str ? ', ' : '');
$str .= intval ($sec);
$str .= (1 < $sec ? ' seconds' : ' second');
}

if (((((!$weeks AND !$days) AND !$hours) AND !$mins) AND !$sec))
{
$str .= '0 seconds ago';
}
else
{
$str .= ' ago';
}

return $str;
}
 
Back
Top