0

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.

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.

Hosangja
  • 1
  • 2
  • Possible duplicate of [How to get Browser Information + Time Stamp with PHP](http://stackoverflow.com/questions/10247038/how-to-get-browser-information-time-stamp-with-php) – Jeff Puckett Jun 14 '16 at 04:31
  • Your approach is wrong. If you *"are available monday- friday 7am to 6pm **EST**"* then it does not matter what timezone the client is in. You're only concerned with hours of operation with regards to Eastern Standard Time. Use the server time, and display an image if it's between 7am-6pm **EST** – Jeff Puckett Jun 16 '16 at 23:13
  • [this is basically what you want](http://stackoverflow.com/a/15911349/4233593) – Jeff Puckett Jun 16 '16 at 23:19

1 Answers1

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.