php - Get local time of user around the globe and show in local timezone format to other timezone user -


i ran trouble while dealing date , time using php , mysql. trying store local time of user's timezone timestamp on mysql db , convert normal date , time @ time of output.

this first time dealing date , time.

as understand: can't rely on php's time() returns servers time according server's timezone , same case mysql current_timestamp.

i can use javascript user's local timezone , can use date_default_timezone_set() each session.

if doing right, confusion starts.

as can understand users come around globe, if 2 users (one , india) @ same time, show each others time identical or show difference? mean shouldn't show indian user user has done few hours ago user done @ same time.

please let me know if don't understand these things properly.

what want achieve is, output of time should show in local time format. ex: time should show in ist format indian user , other country respectively.

best way achieve store date in database in standard format (eg. gmt).

after getting user's timezone through javascript, may convert date user's timezone & display accordingly.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -