SyncViews Posted January 10, 2008 Share Posted January 10, 2008 All the dates etc on my site are always GMT - 5. How do I make it so by default they are always GMT +- what ever the user set? I thought of adding the correct number of seconds to the outputs of time() etc but I'm sure theres a better way (eg something to make the date functions display the date/time arcording to a certain timezoe) Quote Link to comment https://forums.phpfreaks.com/topic/85390-time-zones/ Share on other sites More sharing options...
revraz Posted January 10, 2008 Share Posted January 10, 2008 You can set the timezone in the php.ini if you use PHP 5. Quote Link to comment https://forums.phpfreaks.com/topic/85390-time-zones/#findComment-435658 Share on other sites More sharing options...
cooldude832 Posted January 10, 2008 Share Posted January 10, 2008 this is a good suggestion if you make a large site make a file called constants.php and include in it all the stuff you want to set your mysql login info, mysql databases folder locations etc. and include your currency type and location looks sorta like <?php date_default_timezone_set('GMT'); date_default_timezone_set('GMT'); //All constants used on the site define("ROOT",$_SERVER['DOCUMENT_ROOT']."/"); define("BASE", "http://www.mysite.com/"); define("LOGIN_BASE", "http://www.mysite.com/login/"); define("SCRIPTS", ROOT."scripts/"); define("SUB_FOLDER", BASE."source/"); define("GRAPHICS", BASE."graphics/"); define("SOURCES", BASE."sources/"); define("IMAGES", BASE."images/"); define("CSS", BASE."css/"); define("EXT", ".php"); define("USERS_TABLE", "User"); define("UP_TABLE", "UP"); define("DEALS_TABLE", "Deals"); define("DEALS_RATINGS_TABLE", "Deals_ratings"); define("DEALS_SPAM_TABLE", "Deals_spam"); //SQL DB INFO HERE define("SQL_PORT", ""); define("SQL_USER", "********"); define("SQL_PASS", "*****"); define("SQL_DB", "******"); //Max amoutn of spam counts before delete define("MAX_SPAM_COUNT", "5"); ?> and then on each page you reference it by saying <?php require_once('constants.php'); ?> and you will have the time zone set your currency set all your mysql Login data will be easy to remember etc. etc. Quote Link to comment https://forums.phpfreaks.com/topic/85390-time-zones/#findComment-435660 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.