Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How to get Server timezone with WHM API?

Discussion in 'cPanel Developers' started by stephane02, Dec 22, 2011.

  1. stephane02

    stephane02 Member

    Joined:
    Dec 14, 2011
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Root Administrator
    Hi,

    I just need to get WHM server time using WHM API. Is it possible ?

    Thx for helping.
     
  2. faisikhan

    faisikhan Well-Known Member

    Joined:
    Dec 12, 2011
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    56
    Location:
    Islamabad, Pakistan
    cPanel Access Level:
    Root Administrator
    Hi

    I have also searched about it a lot & unfortunately the conclusion is there isn't any API for this yet. But you can get the time zone being displayed with a PHP script(Consult a Developer ). May be this can help you if you got any previous ideas about the .htaccess file;

    Here are the sample code for this if you want to use .htaccess file:

    You can set the timezone in .htaccess as well and can create a New File and name it ".htaccess", or you can edit the existing one. The .htaccess file belongs in /public_html/ or a subdirectory if for a subdomain or addon domain.

    Add the line: SetEnv TZ America/Indianapolis
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. stephane02

    stephane02 Member

    Joined:
    Dec 14, 2011
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Root Administrator
    If you read it again you'll see I mean getting server time not setting it. I just want to synchronize my plugin time with server time but it's not good at all that cPanel/WHM API didn't consider a single line about it...even server info api function
     
  4. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,216
    Likes Received:
    10
    Trophy Points:
    313
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Which programming language are you using? Most have a built-in function for this, hence I ask.
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice