everlifefree Posted January 5, 2008 Share Posted January 5, 2008 I was wondering if you could help me make it so that my users last login and online since will so the proper time relating to there timezone instead of just the time on the server. When my user sign up the enter a variable into the database of like "US mountain time would be -7" and the variable "-7" in stored in the database table users under the timezone section thing... Please help! heres the current php used: /* Figure out if the user is online or not */ if (_fnc("user", $_GET["id"], "last_load") > (date("U") - 180)) { $tpl -> Zone("onlinecheck", "online"); $tpl -> AssignArray(array( "onlinesince" => date($CONF["LOCALE_SHORT_TIME"], _fnc("user", $_GET["id"], "last_login")), "online.object" => $GLOBALS["OBJ"]["online"] )); } elseif (_fnc("user", $_GET["id"], "last_login") != 0) { $tpl -> Zone("onlinecheck", "offline"); $tpl -> AssignArray(array( "lastlogin" => date($CONF["LOCALE_SHORT_DATE_TIME"], _fnc("user", $_GET["id"], "last_login")), "online.object" => NULL )); } else { $tpl -> Zone("onlinecheck", "nologin"); $tpl -> AssignArray(array( "lastlogin" => NULL, "online.object" => NULL )); } Quote Link to comment https://forums.phpfreaks.com/topic/84587-timezone-alter-time/ Share on other sites More sharing options...
revraz Posted January 5, 2008 Share Posted January 5, 2008 This is what I do $offset = (60 * 60) * $_SESSION['offset']; <?php echo date('m/d/Y-H:i',$row->ndate + $offset);?> Where $_SESSION['offset'] is like -3 or whatever the offset value is for them. Quote Link to comment https://forums.phpfreaks.com/topic/84587-timezone-alter-time/#findComment-431040 Share on other sites More sharing options...
everlifefree Posted January 5, 2008 Author Share Posted January 5, 2008 but how to I get the offset to automaticly change to the correct +/- whatever that is listed in the database table "users" under the timezone area Quote Link to comment https://forums.phpfreaks.com/topic/84587-timezone-alter-time/#findComment-431044 Share on other sites More sharing options...
revraz Posted January 5, 2008 Share Posted January 5, 2008 $_SESSION['offset'] is set when they login and the DB is queried. Quote Link to comment https://forums.phpfreaks.com/topic/84587-timezone-alter-time/#findComment-431045 Share on other sites More sharing options...
everlifefree Posted January 5, 2008 Author Share Posted January 5, 2008 HUH?? sorry I'm sort of new to this whole php scriptting I have only figured out the very very basics of how it all works. So is the offset set in like the database for each user or what Quote Link to comment https://forums.phpfreaks.com/topic/84587-timezone-alter-time/#findComment-431046 Share on other sites More sharing options...
revraz Posted January 5, 2008 Share Posted January 5, 2008 For me it is, and according to this post, it seems it is for you too. but how to I get the offset to automaticly change to the correct +/- whatever that is listed in the database table "users" under the timezone area Quote Link to comment https://forums.phpfreaks.com/topic/84587-timezone-alter-time/#findComment-431048 Share on other sites More sharing options...
everlifefree Posted January 5, 2008 Author Share Posted January 5, 2008 well right now it is set in my database under timezone does it need a further code to acquire it or do I need to just simple change the timezone to offset?? Still very confused could you please in detail explain how this works... Quote Link to comment https://forums.phpfreaks.com/topic/84587-timezone-alter-time/#findComment-431052 Share on other sites More sharing options...
everlifefree Posted January 5, 2008 Author Share Posted January 5, 2008 Could anyone give me more details here?? Quote Link to comment https://forums.phpfreaks.com/topic/84587-timezone-alter-time/#findComment-431418 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.