soycharliente Posted July 9, 2007 Share Posted July 9, 2007 I tried searching for the answer, but didn't really get anything back. Maybe it's the terminology I was using. Can anyone help me in a direction for how to change what time zone a time is displayed for? My timestamps default to California and would like to show them as EST. Or even show the time in whatever time zone the person viewing the time is in. Does that sentence make sense? Link to comment https://forums.phpfreaks.com/topic/59131-solved-show-time-in-local-time/ Share on other sites More sharing options...
trq Posted July 9, 2007 Share Posted July 9, 2007 Or even show the time in whatever time zone the person viewing the time is in Easiest way to do that is use javascript. It uses the time on the client. Link to comment https://forums.phpfreaks.com/topic/59131-solved-show-time-in-local-time/#findComment-293629 Share on other sites More sharing options...
soycharliente Posted July 9, 2007 Author Share Posted July 9, 2007 Is it possible in PHP? Link to comment https://forums.phpfreaks.com/topic/59131-solved-show-time-in-local-time/#findComment-293630 Share on other sites More sharing options...
trq Posted July 9, 2007 Share Posted July 9, 2007 Take a look at date_default_timezone_set. Link to comment https://forums.phpfreaks.com/topic/59131-solved-show-time-in-local-time/#findComment-293637 Share on other sites More sharing options...
soycharliente Posted July 9, 2007 Author Share Posted July 9, 2007 I'm getting this error: Fatal error: Call to undefined function: date_default_timezone_set() in /index.php on line 4 For this code: date_default_timezone_set(date_default_timezone_get()); I thought it was a built-in function. EDIT: OOOH! PHP 5.0+ DOH! So what can I do with PHP 4.3.11? Link to comment https://forums.phpfreaks.com/topic/59131-solved-show-time-in-local-time/#findComment-293642 Share on other sites More sharing options...
marcus Posted July 9, 2007 Share Posted July 9, 2007 It's for PHP5+ Link to comment https://forums.phpfreaks.com/topic/59131-solved-show-time-in-local-time/#findComment-293643 Share on other sites More sharing options...
soycharliente Posted July 9, 2007 Author Share Posted July 9, 2007 Made an edit, maybe it got skipped. So what can I do with PHP 4.3.11? I found this, but it doesn't seem to work very well. It's giving me a date from like 14 hours ago. <?php $record = file("http://api.hostip.info/get_html.php?ip=". $_SERVER['REMOTE_ADDR']."&position=true"); $longitude = substr($record[3], 11); $offset = $longitude / 15; $true_local_time = gmmktime() + ($offset * 3600); //return $true_local_time; echo date('M j Y, H:m:s', $true_local_time); ?> That came from this page: http://www.expertsrt.com/tutorials/Matt/PHPTimeZone.html Link to comment https://forums.phpfreaks.com/topic/59131-solved-show-time-in-local-time/#findComment-293659 Share on other sites More sharing options...
per1os Posted July 9, 2007 Share Posted July 9, 2007 Are you sure that data is pulling correctly from the remote site. Do a vardump on $record. Link to comment https://forums.phpfreaks.com/topic/59131-solved-show-time-in-local-time/#findComment-293665 Share on other sites More sharing options...
soycharliente Posted July 9, 2007 Author Share Posted July 9, 2007 Country: UNITED STATES (US) City: Atlanta, GA Latitude: 33.7629 Longitude: -84.4226 Link to comment https://forums.phpfreaks.com/topic/59131-solved-show-time-in-local-time/#findComment-293670 Share on other sites More sharing options...
soycharliente Posted July 9, 2007 Author Share Posted July 9, 2007 I just won't do it. Nevermind. Seems like too much work. Link to comment https://forums.phpfreaks.com/topic/59131-solved-show-time-in-local-time/#findComment-293679 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.