Welcome Guest, Not a member yet? Register   Sign In
Timezones
#1

[eluser]renownedmedia[/eluser]
I've been adding the following line to my entry point of time-sensitive applications before using CI:

Code:
putenv("TZ=America/Detroit");

I'm wondering two things, the first is should I be using this line in my applications or is there a better method, and also should I stick this in the index.php of CI or is there a better location?
#2

[eluser]sharpe[/eluser]
1. You could use
Code:
date_default_timezone_set('America/Detroit');
2. You should create an pre_system hook Hooks - Extending the Framework Core

Code:
$hook['pre_system'][] = array(
                                'class'    => '',
                                'function' => 'init',
                                'filename' => 'init.php',
                                'filepath' => 'hooks',
                                'params'   => array()
                                );

init.php file
Code:
function init()
{
  date_default_timezone_set('America/Detroit');
  //etc...
}

remember to have $config['enable_hooks'] = TRUE //config.php
#3

[eluser]bluepicaso[/eluser]
Thanks a lot sharp




Theme © iAndrew 2016 - Forum software by © MyBB