Jump to content

displaying time and date


Recommended Posts

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..

Link to comment
Share on other sites

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'}

Link to comment
Share on other sites

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');

Link to comment
Share on other sites

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 by AffordableDomainsCanada
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated