admin管理员组文章数量:1289957
how can I get user Time Zone in Wordpress if you don't know where the user comes from.
Let's say if a user is in USA I need to get USA Time Zone, if the user is in Germany I need to get Germany Time Zone.
how can I get user Time Zone in Wordpress if you don't know where the user comes from.
Let's say if a user is in USA I need to get USA Time Zone, if the user is in Germany I need to get Germany Time Zone.
Share Improve this question asked Jun 25, 2021 at 7:50 BesartBesart 1011 bronze badge 6 | Show 1 more comment1 Answer
Reset to default 1Since 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 you attempt to infer the user's timezone:
-new Date().getTimezoneOffset()/60;
And then ask the user to confirm that it is the correct timezone. Keep in mind, client side code is run on the user's machine and can be disabled entirely.
本文标签: phpHow to get User Time Zone in Wordpress
版权声明:本文标题:php - How to get User Time Zone in Wordpress? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741484113a2381321.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
ip_info("Visitor", "Country");
– Besart Commented Jun 25, 2021 at 8:36