1

I want to display local timezone for all countries.

Example : A) If I post a article from India at 11:09 AM 21 October 2019. Display time in other countries should be like this :

1) India - 11:09 AM 21 October 2019 (IST) 
2) Canada - 1:39 AM  21 October 2019 (GMT-4) 
3) USA - 1:39 AM 21 October 2019 (GMT-4) 
4) UK - 6:39 AM 21 October 2019 GMT+1) 
5) Singapore - 1:39 PM 21 October 2019 (GMT+8)

Example : B) If I post a article from USA at 1:39 AM 21 October 2019. Display time in other countries should be like this :

1) USA - 1:39 AM 21 October 2019 (GMT-4) 
2) Canada - 1:39 AM  21 October 2019 (GMT-4) 
3) India - 11:09 AM 21 October 2019 (IST)  
4) UK - 6:39 AM 21 October 2019 GMT+1) 
5) Singapore - 1:39 PM 21 October 2019 (GMT+8)

I have done this application in codeigniter with date_default_timezone_set('Asia/Kolkata'); is default timezone. The problem is facing with other countries timezone.

And tried with php timezone conversion but it is not working.

Lets-c-codeigniter
  • 682
  • 2
  • 5
  • 18
  • Possible duplicate of [PHP Timezone List](https://stackoverflow.com/questions/4755704/php-timezone-list) – PHP Ninja Oct 21 '19 at 06:32
  • @Gulshan , How it is duplicate ? My problem is fully different from you mentioned. – Lets-c-codeigniter Oct 21 '19 at 06:40
  • 1
    How do you calculate the above when a country / continent spans multiple timezones? For instance: You reference `USA` - that has, I believe, 6 timezones! Also - USA is never referenced as such in any timezone constants - what mechanism do you envisage for this lookup? – Professor Abronsius Oct 21 '19 at 09:07
  • i think you should do a proper research here - in order to display users timezone you have to get their timezone at first (and there are a ton of solved questions on SO e.g. https://stackoverflow.com/questions/4746249/get-user-timezone). Once you got their timezone you can try your timezone conversion. Especially the answer https://stackoverflow.com/a/797/3436643 is a hint how to solve such tasks. – Atural Oct 21 '19 at 10:43

0 Answers0