1

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.

Gelxxxx
  • 161
  • 1
  • 17
Joe
  • 21
  • 2
  • The time zone from the client can not be determined with PHP. More:How to automatically detect user's timezone? https://stackoverflow.com/questions/5203382/how-to-automatically-detect-users-timezone – jspit Sep 19 '19 at 07:41
  • as facebook , use country to defined timezone , so easy you can delect time zone for each country and + or - it from time current time zone and after all add the result to date time to that user :) – Mikel Tawfik Sep 19 '19 at 10:25

1 Answers1

0

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 :)

MorganFreeFarm
  • 3,811
  • 8
  • 23
  • 46