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

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

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

Timezone for Plugin

Updated December 10, 2018 03:08 AM

How to get Unix Local Time?

Updated December 05, 2018 06:08 AM

Force WP_Query to work in a local timezone

Updated August 30, 2017 23:08 PM