karthikeyan_coder Posted October 16, 2006 Share Posted October 16, 2006 here is the two functions for showing time in the format "3:57 pm"[code]function convert_timestamp($timestamp, $timezoneOffset=0) { $replacements = array( '-' => '', ' ' => '', ':' => ''); $timestamp = strtr($timestamp, $replacements); return $timestamp?mktime( substr($timestamp,8,2), substr($timestamp,10,2) - $timezoneOffset + $GLOBALS['fc_config']['timeOffset'], substr($timestamp,12,2), substr($timestamp,4,2), substr($timestamp,6,2), substr($timestamp,0,4) ):0; } function format_Timestamp($timestamp, $tzoffset) { return gmdate($GLOBALS['fc_config']['timeStampFormat'], convert_timestamp($timestamp, $tzoffset)); }[/code]i need these functions to show US time... how can we change these functions to show US time? Thank you. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted October 16, 2006 Share Posted October 16, 2006 Why can't you use the [url=http://www.php.net/date]date()[/url] function to format the time string?Ken Quote Link to comment Share on other sites More sharing options...
karthikeyan_coder Posted October 16, 2006 Author Share Posted October 16, 2006 ohh... ok... how can i make gmt conversions from the actual server time? Quote Link to comment Share on other sites More sharing options...
alpine Posted October 16, 2006 Share Posted October 16, 2006 [code]<?phpecho date("h:i a"); // format 3:57 pmecho date("h:i a",strtotime('now + 2 hours')); // + 2 hours = 5:57 pmecho date("h:i a",strtotime('now - 1 hours')); // - 1 hour = 2:57 pm?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.