-1

I'm learning PHP.

I have online classes on Zoom at 11:00, 15:00, and 19:00 BST which is UT+1, but I need to display on a (WordPress) webpage what times they are in the student's local time. In other words, set up a web page to query their browser to get their timezone offset and add that to my local class times so they can display in their timezone's times.

Skipper
  • 1
  • 2
  • Hi @Skipper, thanks for providing some background on your question. Can you explain what you've tried so far and where you're stuck? The code you have so far would be helpful too. – Cam Apr 03 '22 at 01:51
  • Does this answer your question? [PHP: Show time based on user's timezone](https://stackoverflow.com/questions/15149186/php-show-time-based-on-users-timezone) – Stoff Apr 03 '22 at 02:30
  • If not, you can use javascript to check the time offset, then convert the date and time of your event to whatever timezone the user is using locally. – Stoff Apr 03 '22 at 02:30
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Apr 03 '22 at 18:05
  • I have a 3 o'clock Zoom class each day, I want the user to be able to see what time the class is for them if they are in a different timezone and show this to them when they sign up. So for example for someone in London it would be 3 o'clock because that is my timezone too, but if someone looks at my website from say Texas which is GMT minus 6 the class time will appear as 9am. – Skipper Nov 03 '22 at 14:20

1 Answers1

0

You can't do that from PHP. To get the user's local time, use JavaScript instead of PHP.

const d = new Date();
let years = Math.round(d.getTime() / year);

PHP only gives back the server's time.

benadzs
  • 127
  • 2
  • 13