Welcome Guest, Not a member yet? Register   Sign In
Date Functions and date_default_timezone_set()
#1

[eluser]caen[/eluser]
After I installed CI, I set the $config['time_reference'] variable to "gmt" and tried using the mdate() function. I got a warning saying that I should use date_default_timezone_set() in order to set a locale. Is that necessary, or am I doing something wrong? Would it be a better idea to set it in the php.ini file? Thanks!
#2

[eluser]OliverHR[/eluser]
If have access to your php ini, well you must set to avoid this warning.
#3

[eluser]caen[/eluser]
Thank you! Right now, I have it manually set in the config.php file. I find it safer, some web hosting providers do not grant you access to the ini file and might not always configure it correctly.
#4

[eluser]InsiteFX[/eluser]
Add to the top of index.php
Code:
date_default_timezone_set('America/New_York');
/*
|---------------------------------------------------------------
| DEFAULT INI SETTINGS
|---------------------------------------------------------------
|
| Hosts have a habbit of setting stupid settings for various
| things. These settings should help provide maximum compatibility
| for PyroCMS
|
*/

// Let's hold Windows' hand and set a include_path in case it forgot
set_include_path(dirname(__FILE__));

// Some hosts (was it GoDaddy? complained without this
@ini_set('cgi.fix_pathinfo', 0);

// PHP 5.3 will BITCH without this
if (ini_get('date.timezone') == '')
{
    date_default_timezone_set('GMT');
}

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB