Title: Use Client&#039;s Time Zone
Author: drmikegreen
Published: <strong>20 de setembre de 2012</strong>
Last modified: 13 d'octubre de 2023

---

Cerca extensions

Aquesta extensió **no s’ha provat en les darreres 3 versions majors del WordPress**.
Segurament no està mantinguda o suportada, i pot tenir problemes de compatibilitat
quan s’usa en versions recents del WordPress.

![](https://s.w.org/plugins/geopattern-icon/use-clients-time-zone.svg)

# Use Client's Time Zone

 Per [drmikegreen](https://profiles.wordpress.org/drmikegreen/)

[Baixa](https://downloads.wordpress.org/plugin/use-clients-time-zone.zip)

 * [Detalls](https://ca.wordpress.org/plugins/use-clients-time-zone/#description)
 * [Ressenyes](https://ca.wordpress.org/plugins/use-clients-time-zone/#reviews)
 *  [Instal·lació](https://ca.wordpress.org/plugins/use-clients-time-zone/#installation)
 * [Desenvolupament](https://ca.wordpress.org/plugins/use-clients-time-zone/#developers)

 [Suport](https://wordpress.org/support/plugin/use-clients-time-zone/)

## Descripció

This plugin retrieves the time zone of the client using “Automatic Timezone Detection
Using JavaScript” (http://pellepim.bitbucket.org/jstz/) the first time that a client
accesses the site, sets a cookie containing the client’s time zone on the client,
and reloads the page. This cookie is then read by PHP and the date_default_timezone_set()
function (requires PHP 5 >= 5.1.0) is used to set the default time zone for PHP 
scripts. Since it runs just after all of the plugins are loaded, it changes the 
time zone for all of the PHP that follows. It is useful in cases where one wants
users to see certain posts on certain days. E.g., if the post slug contains the 
day number, like “xyz-daynr,” then the post can be specified by “$slug = ‘xyz’.date(
j);” in a theme template. The cookie does not expire for ten years, but is reset
if the user changes time zones. So, unless the user deletes cookies or moves the
page reload only occurs once every ten years.

NOTE:

A remark was posted in our forum stating that sites may experience problems if changing
timezones using date_default_timezone_set. WP expects it to always be UTC and display
of things in different timezones are achieved in other ways:
 [https://vip.wordpress.com/documentation/vip-development-tips-tricks/use-current_time-not-date_default_timezone_set/](https://vip.wordpress.com/documentation/vip-development-tips-tricks/use-current_time-not-date_default_timezone_set/)
[https://weston.ruter.net/2013/04/02/do-not-change-the-default-timezone-from-utc-in-wordpress/](https://weston.ruter.net/2013/04/02/do-not-change-the-default-timezone-from-utc-in-wordpress/)

The author has not observed any problems on the sites on which this plugin has been
tested. Based on the foregoing post, however,it would be wise to check that no date-
related operations are going awry after activating this plugin — even though no 
problems have been observed with the sites tested.

Copyright 2012-2023 M.D. Green, SaeSolved:: LLC

### License

This program is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the
 Free Software Foundation;
either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY 
WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.

## Captures

 * [[
 * Settings page.

## Instal·lació

 1. Extract the use-clients-timezone folder and place in the wp-content/plugins folder.
 2. Enable the plugin.
 3. Set the fallback time zone under Settings->Use Client’s Timezone. (The time zone
    to use if the script fails to get the client’s time zone.)

## PMF

### Where can I see a working example of this plugin?

http://eveypeople.net/ — the number of days until Ramadan (or day in Ramadan).

You can test this by changing the time on your computer to be in a time zone which
is in a different day. E.g., if you live in New York, change the time zone on your
computer to that of Sydney. You should see the number of days change. (Check a site
like http://www.timeanddate.com/ to be sure to get a time zone which is in a different
day than the one normally set on your computer.)

## Ressenyes

![](https://secure.gravatar.com/avatar/b8b5d05f16c9f7a56e2e008a523e8bbb27f52a91f8692e8265f2831d7063f2d7?
s=60&d=retro&r=g)

### 󠀁[Works Flawlessly](https://wordpress.org/support/topic/works-flawlessly-197/)󠁿

 [Generosus](https://profiles.wordpress.org/generosus/) 13 de octubre de 2023

This is the ONLY plugin in WordPress’ repository capable of detecting and displaying
a site visitor’s local time and time zone on the site’s frontend. Bonus: This plugin
is compatible with WordPress 6.3.2 and PHP 8.3.0 (latest versions as of today). 
Note: If you’re having any issues using this plugin, please visit the plugin’s support
forum for a solution. Kudos to the developer!

![](https://secure.gravatar.com/avatar/1cdc7e2a8f59e492f6918833360f4f4c9cf50cf31824d2f12a0f9d08e4c45be2?
s=60&d=retro&r=g)

### 󠀁[Work fine on WP 5.8.2](https://wordpress.org/support/topic/work-fine-on-wp-5-8-2/)󠁿

 [Saad Sheikh](https://profiles.wordpress.org/saadsheikh/) 5 de desembre de 2021
1 resposta

Thank you for this useful plugin, it works fine on WP 5.8.2. Please keep it maintained.

![](https://secure.gravatar.com/avatar/bd005d51e9459976798b6e2a370a6d089b2473ec1a604446004bc998e2eb801c?
s=60&d=retro&r=g)

### 󠀁[Working perfectly with 4.8.2](https://wordpress.org/support/topic/working-perfectly-with-4-8-2/)󠁿

 [alangrainger](https://profiles.wordpress.org/alangrainger/) 25 de setembre de 
2017

Does exactly what it says.

![](https://secure.gravatar.com/avatar/3272f94e622c23cdadcebdf2e2970e40398b256aa1ee9ee670c597767b093544?
s=60&d=retro&r=g)

### 󠀁[Magnificent](https://wordpress.org/support/topic/magnificent-10/)󠁿

 [neosoft](https://profiles.wordpress.org/neosoft/) 17 de desembre de 2016

Fine

 [ Llegiu totes les 7 ressenyes ](https://wordpress.org/support/plugin/use-clients-time-zone/reviews/)

## Col·laboradors i desenvolupadors

«Use Client's Time Zone» és programari de codi obert. La següent gent ha col·laborat
en aquesta extensió.

Col·laboradors

 *   [ drmikegreen ](https://profiles.wordpress.org/drmikegreen/)

[Traduïu «Use Client's Time Zone» a la vostra llengua.](https://translate.wordpress.org/projects/wp-plugins/use-clients-time-zone)

### Interessats en el desenvolupament?

[Navegueu pel codi](https://plugins.trac.wordpress.org/browser/use-clients-time-zone/),
baixeu-vos el [repositori SVN](https://plugins.svn.wordpress.org/use-clients-time-zone/),
o subscriviu-vos al [registre de desenvolupament](https://plugins.trac.wordpress.org/log/use-clients-time-zone/)
per [fisl de subscripció RSS](https://plugins.trac.wordpress.org/log/use-clients-time-zone/?limit=100&mode=stop_on_copy&format=rss).

## Registre de canvis

#### 1.1.5

Code added to avoid activating actual use of plugin, other than the settings in 
the admin screen, during site administration.

#### 1.1.4

Added advice to check that no dated-related operations were adversely impacted by
this plugin.

#### 1.1.3

Changed cookie path to be site-wide.

#### 1.1.2

Changed JavaScript so that the page is not reloaded if cookies are not enabled on
the client.

#### 1.1

Method for obtaining client time zone changed from attempting to retrieve time zone
of IP to setting a cookie containing the clients time zone, then reading that cookie.

#### 1.0

Original release.

## Meta

 *  Versió **1.1.5**
 *  Darrera actualització **fa 2 anys**
 *  Instal·lacions actives **100+**
 *  Versió del WordPress ** 1.5 o posterior **
 *  Provada fins a **6.3.8**
 *  Idioma
 * [English (US)](https://wordpress.org/plugins/use-clients-time-zone/)
 * Etiqueta
 * [time zone](https://ca.wordpress.org/plugins/tags/time-zone/)
 *  [Vista avançada](https://ca.wordpress.org/plugins/use-clients-time-zone/advanced/)

## Valoracions

 4.4 sobre 5 estrelles.

 *  [  6 valoracions de 5 estrelles     ](https://wordpress.org/support/plugin/use-clients-time-zone/reviews/?filter=5)
 *  [  0 valoracions de 4 estrelles     ](https://wordpress.org/support/plugin/use-clients-time-zone/reviews/?filter=4)
 *  [  0 valoracions de 3 estrelles     ](https://wordpress.org/support/plugin/use-clients-time-zone/reviews/?filter=3)
 *  [  0 valoracions de 2 estrelles     ](https://wordpress.org/support/plugin/use-clients-time-zone/reviews/?filter=2)
 *  [  1 valoració de 1 estrelles     ](https://wordpress.org/support/plugin/use-clients-time-zone/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/use-clients-time-zone/reviews/#new-post)

[Visualitzeu totes les ressenyes](https://wordpress.org/support/plugin/use-clients-time-zone/reviews/)

## Col·laboradors

 *   [ drmikegreen ](https://profiles.wordpress.org/drmikegreen/)

## Suport

Teniu quelcom a dir? Necessiteu ajuda?

 [Visualitza els fòrums de suport](https://wordpress.org/support/plugin/use-clients-time-zone/)

## Feu una donació

Voleu ajudar a què l’extensió millori?

 [ Feu una donació a aquesta extensió ](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XR9J849YUCJ3A)