Welcome Guest, Not a member yet? Register   Sign In
how to set global time zone
#1

[eluser]promo[/eluser]
Hi

How can I set a timezone in codeigniter for my site (all pages) ?

I tried some values on $config['time_reference'] but it doesn't run.

I need to set brussels timezone.

Thanks.
#2

[eluser]Massaki[/eluser]
index.php (APP PATH)

After inicial tag (<?php):

ini_set('date.timezone', 'Your_timezone');
#3

[eluser]promo[/eluser]
Thanks it's working

But there is no possibility using configuration files of CI ?
#4

[eluser]ivantcholakov[/eluser]
I use CodeIgniter with many customizations and I have got a special configuration file environment.php for this purpose. I can propose to you a little bit ugly solution.

At the beginning of the file application/config/constants.php add the following line:

Code:
require dirname(__FILE__).'/environment.php';

Create the file application/config/environment.php and place there your specific settings related to PHP, an example:

Code:
<?php defined('BASEPATH') OR exit('No direct script access allowed.');

/*
*---------------------------------------------------------------
* PHP ini settings
*---------------------------------------------------------------
*/

ini_set(‘date.timezone’, 'Europe/Sofia');
// or
//@date_default_timezone_set('Europe/Sofia');

ini_set('memory_limit', '512M');
ini_set('post_max_size', '16M');

ini_set('upload_max_filesize', '16M');
ini_set('max_file_uploads', 20);

ini_set('max_execution_time', 30);
ini_set('max_input_time', 60);
#5

[eluser]Unknown[/eluser]
index.php (APP PATH)

After inicial tag (<?php):

ini_set(‘date.timezone’, ‘Your_timezone’);
[URL="http://businesscoachusa.net/"]Technology coach[/URL]
#6

[eluser]Unknown[/eluser]
Nice discussion moving on, I was also looking for method to add global time zone to my website and here Smile Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB