Here's the way i would do this:
function customdate($format,$timestamp)
{
/*
This function takes the same arg's as the regular date()
function, but allows us to return a date that is correct
based on user's timezone.
$usertimeoffset is the var that holds the user's timezone
such as -5, -8, +1, (which means -5:00 GMT, -8:00 GMT, +1:00 GMT).
$servertimezone is the timezone that the server is in....
*/
global $usertimeoffset;
$tmptime = $timestamp + ($usertimeoffset - $servertimezone) * 3600;
//the return line could even include the math, but some say that isn't good... ;)
return date($format, $tmptime);
}
Hope this helps 🙂