EZE Posted February 3, 2007 Share Posted February 3, 2007 How can I get the correct American time using date()? Right now the phpfreaks clock says its 10:30:03pm, where as it is 10:31 pm right now where I am. Here is what I used: echo date("l, g:i:s A, F dS, Y"); This outputs Friday, 8:32:34 PM, February 02nd, 2007. I used the previous date output inside a mail() function, like this: $ip = gethostbyaddr($_SERVER['REMOTE_ADDR']); $browser = $_SERVER['HTTP_USER_AGENT']; $date = date("l, g:i:s A, F dS, Y"); $ref = $_SERVER['HTTP_REFERER']; $mail = mail($to, $subject, "$message\n----- \nUsers IP: $ip\nUsers Browser: $browser\nDate Sent: $date\nSent From: $ref", $extra); What can I do to get it to output correctly? Link to comment https://forums.phpfreaks.com/topic/36870-american-time-zone-correctness/ Share on other sites More sharing options...
corbin Posted February 3, 2007 Share Posted February 3, 2007 date is based off the server's time... Link to comment https://forums.phpfreaks.com/topic/36870-american-time-zone-correctness/#findComment-175910 Share on other sites More sharing options...
hvle Posted February 3, 2007 Share Posted February 3, 2007 what I would recommend is to get a GMT time, then add offset. ie. US Eastern: -5, West Coast: -8 it is accurate and universial. Link to comment https://forums.phpfreaks.com/topic/36870-american-time-zone-correctness/#findComment-175915 Share on other sites More sharing options...
EZE Posted February 3, 2007 Author Share Posted February 3, 2007 I heard somewhere you have to use gmtdate() or something relative to do that, how do you do so? Link to comment https://forums.phpfreaks.com/topic/36870-american-time-zone-correctness/#findComment-175920 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.