AffordableDomainsCanada Posted December 6, 2015 Share Posted December 6, 2015 I have created a page using the php and tpl method. I am trying to display the server time, so I am using this: {$smarty.now|date_format:'%A, %B %d/%Y - %H:%M:%S %Z '} Does this display the server time? or the users local time ? I am trying to get the server time and date being displayed but its showing an hour behind. This is the page I am working on, http://www.affordabledomains.ca/support.php its showing CST but I am in EST and the server timezone is EST also.. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 6, 2015 Share Posted December 6, 2015 Does this display the server time? or the users local time ? it should be the server time.. well, the time based on the server's php settings. I am trying to get the server time and date being displayed but its showing an hour behind.This is the page I am working on, http://www.affordabledomains.ca/support.php its showing CST but I am in EST and the server timezone is EST also.. you could define the timezone in your php file... http://uk1.php.net/manual/en/function.date-default-timezone-set.php alternatively, if CST is always one hour behind EST, and your server thinks it's in EST, you could use the following code in Smarty... {'+1 hour'|strtotime|date_format:'%A, %B %d/%Y - %H:%M:%S EST'} 0 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted December 6, 2015 Author Share Posted December 6, 2015 alternatively, if CST is always one hour behind EST, and your server thinks it's in EST, you could use the following code in Smarty... {'+1 hour'|strtotime|date_format:'%A, %B %d/%Y - %H:%M:%S EST'} This worked perfectly! thank you. 0 Quote Link to comment Share on other sites More sharing options...
Experthost Posted December 7, 2015 Share Posted December 7, 2015 I dare to ask here instead opening a ticket or a new thread: why whmcs uses another timestamp instead server's time ? -2h difference. # date Mon Dec 7 12:31:21 EET 2015 WHMCS displays: Monday, 07 December 2015, 10:32 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted December 7, 2015 Share Posted December 7, 2015 I dare to ask here instead opening a ticket or a new thread: why whmcs uses another timestamp instead server's time ? -2h difference. # date Mon Dec 7 12:31:21 EET 2015 WHMCS displays: Monday, 07 December 2015, 10:32 you may need to set the preferred time zone in WHMCS configuration.php http://php.net/manual/en/function.date-default-timezone-set.php date_default_timezone_set('America/Los_Angeles'); 0 Quote Link to comment Share on other sites More sharing options...
Experthost Posted December 7, 2015 Share Posted December 7, 2015 you may need to set the preferred time zone in WHMCS configuration.php Thanks mate, it did the trick even if the value is already declared in php.ini (root folder & server) so there were 2 ways to have WHMCS correctly read it. Cheers! 0 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted December 8, 2015 Author Share Posted December 8, 2015 (edited) you may need to set the preferred time zone in WHMCS configuration.php <a href="http://php.net/manual/en/function.date-default-timezone-set.php" target="_blank" rel="nofollow">http://php.net/manual/en/function.date-default-timezone-set.php</a> date_default_timezone_set('America/Toronto'); This fixed my timezone issue, now I am using {$smarty.now|date_format:'%A, %B %d/%Y - %H:%M:%S %Z '} so I need to change this.. {if '+1 hour'|strtotime|date_format:'%H' gte 8 AND '+1 hour'|strtotime|date_format:'%H' lt 20} Any ideas ? Edited December 8, 2015 by AffordableDomainsCanada 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 8, 2015 Share Posted December 8, 2015 {if $smarty.now|date_format:'%H' gte 8 AND $smarty.now|date_format:'%H' lt 20} 0 Quote Link to comment Share on other sites More sharing options...
AffordableDomainsCanada Posted December 9, 2015 Author Share Posted December 9, 2015 {if $smarty.now|date_format:'%H' gte 8 AND $smarty.now|date_format:'%H' lt 20} Thank you! 0 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.