简体   繁体   English

我怎样才能让多个用户可以访问他们当前的时区,而不是我的服务器使用 PHP 提供的时区

[英]How can I do so that multiple users can access their current timezone instead of the one provided by my server using PHP

When I echo当我回响

date_default_timezone_get()

It echo's the server datetime instead of my current timezone.它回显的是服务器日期时间,而不是我当前的时区。 I wanted to have my real timezone.我想拥有我的真实时区。 How can I proceed with this.我该怎么做。

You can set your default zone with:您可以使用以下方式设置默认区域:

date_default_timezone_set('America/Los_Angeles');

and get it:并得到它:

$your_timezone = date_default_timezone_get();

Here you can check supported timezones.在这里您可以查看支持的时区。

PS: When you know how to set timezone, you can get users browser timezone, tutorial but you should use JS:) PS:当你知道如何设置时区时,你可以获取用户浏览器时区,教程但你应该使用 JS :)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我如何在我的php服务器上获取系统时区 - how can I get my system timezone on my php server 如何限制对 PHP 文件的访问,以便只能通过服务器中的 iframe 访问它? - How can I restrict access to a PHP file so that it can only be reached via iframe in my server? 如何使用本地IP地址而不是localhost访问数据库mysql服务器 - How can I access my database mysql server using my local ip address instead of using localhost 如何访问php变量,以便可以使用javascript / jquery处理值? - how do i access php variables so that i can work with the values using javascript/ jquery? 在本地主机上使用数据库的亚马逊AWS服务器,我如何ssh以便我可以在localhost上运行我的php webservices? - Amazon AWS server with database on localhost, how do I ssh so that my php webservices on localhost can run on it? 如何在PHP中获取服务器的当前上传速率? - How can I get the current upload rate of my server in PHP? 如何使用一个函数而不是在PHP中使用两个函数来完成相同的工作 - How can I do the same work with one function instead of using two functions in PHP 如何显示已上传到网站服务器上文件夹中的文件,以便用户下载? - How can I display the files I have uploaded to a folder in my server on my website so that users can download them? 如何强制用户通过 HTTPS 而不是 HTTP 访问我的页面? - How can I force users to access my page over HTTPS instead of HTTP? 我可以通过php传递当前变量吗? 如果可以,怎么办? - Can I pass a current variable through php? If so how?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM