This will depend on the user's date/time settings. It will give you the offset based on what the browser sees the timezone is set on the user's computer.
But note that when you are using javascript, it is running on the client-side, i.e. on the browser, and not on the server-side. So you cannot use it in PHP, unless:
- You store it in a cookie (via javascript) the first time a user visits your website.
- You make an AJAX call to store a PHP code to store it in the session.
- If you want to display a time on the user's computer, you send the time difference between the date you want to show and
now()
, and then you add that to the user'sgetTime()
or you display the difference (i.e. 7 hours ago, 2 minutes ago, etc.).