time() with different timezones
<p>How can i get user's local time using php time() or there is another way to do it?
Which means it will be in their timezone.</p>

<p>I need to calculate time ago with user's local time, here's a nice script i found for the time ago function:</p>

<pre><code>&lt;?php
function timeago($time)  
    {  
    $periods = array("second", "minute", "hour", "day", "week", "month", "year", "decade");  
    $lengths = array("60","60","24","7","4.35","12","10");  

    $now = time();

    $difference     = $now - $time;  
    $tense         = "ago";  

    for($j = 0; $difference &gt;= $lengths[$j] &amp;&amp; $j &lt; count($lengths)-1; $j++)   
        {  
        $difference /= $lengths[$j];  
        }  

    $difference = round($difference);  

    if($difference != 1)   
        {  
        $periods[$j].= "s";  
        }  

    return "$difference $periods[$j] $tense";  
    }  
?&gt;

&lt;?php

$date = strtotime('2012-04-15 07:41:03');
$datep = timeago($date);

echo $datep;
?&gt;
</code></pre>

<p>from the above script , i use the time() but it only gets my server time not the local time at my side. how can i get my local time(user's local time)?</p>
