Client's Time Zone Determination
Determining a client's time zone is crucial for time-sensitive applications. This question explores how to obtain this information in the Zend Framework.
Retrieving Time Zone as Seconds Offset
The preferred method for obtaining the time zone is as a delta in seconds from UTC. For instance, Moscow, Russia would return 36060 while London, UK would return 0.
Proposed Solution
The proposed solution involves utilizing jQuery and PHP. JavaScript retrieves the local time and forwards it to the PHP backend.
Implementation Details
PHP Server-side:
HTML/JS Client-side:
PHP Endpoi script (timezone.php):
Benefits of this Approach:
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3