Forum Moderators: coopster
<?php
$new_U=date("U")-0*3600;
$days=array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
print $days[date("w", $new_U)] . ", " . date("F d, Y ", $new_U);
$regHrs=(date("O", $new_U)/100+5)*-1;
print date(" g ", $new_U)+$regHrs . ":" . date("i A", $new_U);
?>
[edited by: jatar_k at 5:13 pm (utc) on Dec. 19, 2004]
[edit reason] changed formatting [/edit]
You can collect the user's UTC offset client-side in Javascript, however the Date object doesn't tell you if Daylight Saving Time is in currently in effect; all you get is raw, current offset seconds. If you just want to display the current time that's fine, but if you're converting arbitrary dates and times into the client's timezone you'll have headaches.