How to get User Time Zone in WordPress?

Since WordPress is a server-side framework/CMS, it likely doesn’t have the functionality you’re looking for. If you’re looking for ways to obtain this information, the most reliable would likely be to ask the user. To make it as painless as possible for the user, this functionality could be achieved via client-side scripting (ie. JavaScript) where … Read more

Why do I need to set my PHP timezone when it’s already set in WordPress?

In functions.php if I add date_default_timezone_set( get_option(‘timezone_string’) ); then $dt will output correctly with “PST”. Yes, but, “don’t change PHP time zone with date_default_timezone_set() (this one is hard requirement for correct core operation!)” — https://make.wordpress.org/core/2019/09/23/date-time-improvements-wp-5-3/. I didn’t think I needed to explicitly set the timezone since I already set it in WordPress WordPress does use … Read more

User specified Timezone

This mission is almost impossible. Players do not stay at one timezone therefor associating a timezone with a player can result in misleading and confusing output. What you can do is move all time to be expressed at a specific time base, lets say UTC, and write some JS that will translate the UTC time … Read more

Is there any way to get a drop down list of time zones?

Enter wp_timezone_choice(): <select> <?php echo wp_timezone_choice( ‘UTC’ ) ?> </select> Make sure to check out the documentation link, but the parameters are: $selected_zone (string) (Required) Selected timezone. $locale (string) (Optional) Locale to load the timezones in. Default current site locale.