Jump to content

Recommended Posts

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)

Link to comment
https://forums.phpfreaks.com/topic/85390-time-zones/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/85390-time-zones/#findComment-435660
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.