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. Link to comment https://forums.phpfreaks.com/topic/24118-complex-time-problem-gurus-can-help/ 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 Link to comment https://forums.phpfreaks.com/topic/24118-complex-time-problem-gurus-can-help/#findComment-109640 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? Link to comment https://forums.phpfreaks.com/topic/24118-complex-time-problem-gurus-can-help/#findComment-109642 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] Link to comment https://forums.phpfreaks.com/topic/24118-complex-time-problem-gurus-can-help/#findComment-109648 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.