How to get the correct date depending on the current visitor timezone?

by John   Last Updated September 14, 2018 14:08 PM

I want to change the date format for my custom post types from dates to time.

So i starting using this code:

echo get_post_time('g:i A', TRUE, get_the_ID(), TRUE );

It's working successfully but the problem now that it's getting the timezone from the WordPress settings not getting the timezone of the current visitor.

Many sites like facebook or twitter check the timezone of the visitor and get the correct dates depending on his/her location.

How can I do the same?

NOTE: I can do anything to achieve this (Plugins, PHP Scripts) anything.

Related Questions

How to get WordPress Time Zone setting?

Updated April 21, 2015 21:03 PM

Date, Time, and Timezones

Updated October 16, 2017 09:08 AM

Force WP_Query to work in a local timezone

Updated August 30, 2017 23:08 PM

Make Wordpress use timezone for email Date header

Updated July 25, 2018 01:08 AM

Convert CST published date time to MST timezone

Updated September 25, 2018 17:08 PM