php - How tell the local time of a web visitor? -
i'm building blog engine in cakephp , show current visitor articles relative local time of day.
for visitors it's morning, i'll show articles related starting day , news items happened overnight.
for visitors it's evening, i'll show articles recap highlights of major events during day.
the possible solution can think of send current timezone via javascript server, can happen after web page has loaded. how can did @ time cakephp application renders pagination view index action?
you better store difference in gmt user using
var d = new date() var n = d.gettimezoneoffset(); now @ first page, run code on page load , store value of n in db using ajax or whatever.so whenever user login time diff till he/she logout.use db value (store in session better use) further process.
further create function
addgmtdiff() { // fetch stored value difference , return } call function after every sql query fetched utc time.
Comments
Post a Comment