Get server timezone In PHP

0 votes

My client need a system report of the server information for his plugin running, hence I must obtain the SERVER timezone. utilizing Wordpress. I tried this, however not all servers are compatible.

$date = new DateTime();
$date->setTimezone(new DateTimeZone(ini_get('date.timezone')));

On some servers, this results in a catastrophic error. Is there a widely used function to determine the server timezone?
We would much appreciate any advice.

Aug 7 in PHP by Kithuzzz
• 12,240 points
42 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In PHP

0 votes
1 answer

How to get the client IP address in PHP ?

Hello, Here is a code sample of a good ...READ MORE

answered Apr 8, 2020 in PHP by Niroj
• 82,780 points
5,006 views
0 votes
1 answer
0 votes
1 answer

How to get current URL path in PHP?

Hello @kartik, Use $_SERVER['REQUEST_URI'].  The URI which was given in ...READ MORE

answered Sep 1, 2020 in PHP by Niroj
• 82,780 points
2,715 views
0 votes
1 answer

Error:Internal server errordisplay in PHP via htaccess only

Hello @kartik,  Try adding this line .htaccess: php_flag display_startup_errors ...READ MORE

answered Sep 1, 2020 in PHP by Niroj
• 82,780 points
298 views
0 votes
1 answer

How to Get the full URL in PHP?

Hello @kartik, Have a look at $_SERVER['REQUEST_URI'], i.e. $actual_link = ...READ MORE

answered Sep 16, 2020 in PHP by Niroj
• 82,780 points
1,364 views
0 votes
1 answer

How do I get a file extension in PHP?

Hello @kartik, pathinfo() $path_info = pathinfo('/foo/bar/baz.bill'); echo $path_info['extension']; // "bill" Hope ...READ MORE

answered Sep 16, 2020 in PHP by Niroj
• 82,780 points
440 views
0 votes
1 answer
0 votes
0 answers
0 votes
1 answer

How to Access Yoast SEO tags in Wordpress API Callback

use rest api to request for the ...READ MORE

answered Feb 12 in Others by narikkadan
• 20,880 points
298 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP