I currently have a banner on my website that states: "we are available monday- friday 7am to 6pm est [call now]" I would like to use php to identify the time zone the user is in and display the banner on the page only if the user is on the website during our hours of opperation.
我目前在我的网站上有一个横幅,上面写着:“我们可以在星期一上午7点到下午6点使用est [立即致电]”我想使用php来识别用户所在的时区并仅在页面上显示横幅如果用户在我们的操作时间内在网站上。
Essentially the banner will be used to prompt the user to make a phone call. The issue is that we dont want users to call when we are unavailable, and therefore would like to hide it from users in all time zones if they are on our site while we are closed.
本质上,横幅将用于提示用户拨打电话。问题是我们不希望用户在我们不可用时拨打电话,因此如果他们在我们关闭时在我们的网站上,则希望将其隐藏在所有时区的用户中。
Is it possible to get this done using php? I am not very experienced with this programing language and appreciate any help i can get.
是否可以使用PHP完成此操作?我对这种编程语言不是很有经验,并感谢我能得到的任何帮助。
1 个解决方案
#1
0
date_default_timezone_set('Asia/Jakarta');//it is your country
$current_date = date("Y-m-d H:i:s");
this is your current datetime. Set it in your code.
这是您当前的日期时间。在代码中设置它。
#1
0
date_default_timezone_set('Asia/Jakarta');//it is your country
$current_date = date("Y-m-d H:i:s");
this is your current datetime. Set it in your code.
这是您当前的日期时间。在代码中设置它。