How to get WordPress Time Zone setting?

In this tutorial we’ll learn how to get time zone settings in a wordpress site. To achieve this first we need to make sure that our timezone settings have been properly set. To do this navigate to general link under settings tab.

woocommerce

Here you can set the time zone settings for your specific city.

Now let’s say I want to display the timezone settings in the header. We need to add following line of code in the header.php of our file.

<?php echo get_option('timezone_string'); ?>

To access header.php go to editor link under appearance tab and look for header.php

woocommerce

And the line of code as:

woocommerce

Refresh the front end of your site and you’ll see the time zone settings in the header as.

woocommerce

Waqas

I hope you enjoy reading this blog post. If you want my team to do WooCommerce Maintenance for you, click here.

Leave a Comment

Your email address will not be published. Required fields are marked *