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.
var tzo=(new Date().gettimezoneoffset()/60)*(-1);
and write the date info the dom using JS date functions. A second way could be, always with js, set a cookie containing the timezone info and access the cookie via php – Andrea Somovigo Sep 14 '18 at 15:16