It has been seen that often the server is located in differnt timezones than ours….. Its been too tough to change the timezones in CodeIgniter for me. To resolve this problem we can add a simple helper file. For this you need to do the following steps.
Step 1. Create a folder in your applications folder named ‘helpers’
Step2. Save a file with named ‘zea_helper.php’ containing
function bd_time() {
return mktime((gmdate('H').'GMT')+6, date("i"), date("s"), date("m"), date("d"), date("y"));
}
in the above created ‘helpers’ folder. I have used +6 bceause bangladesh time is GMT 6+, if your time is GMT -4 you should write “(gmdate(‘H’) . ‘ GMT’)-4,” instead (gmdate(‘H’) . ‘ GMT’)+6,
Step3. Go to your autoload.php in config folder and change the line $autoload['helper'] = array(”); to $autoload['helper'] = array(‘zea’); and save the file.
Step4. Now just load the helper just like other helpers in your controller like $this->load->helper(‘zea’);. and start using it as a helpers
ex: echo date(“F j, Y, g:i a”,bd_time());
dont forget to load the helper in the controller.
Great post! Just wanted to let you know you have a new subscriber- me!
Hi, interest post. I’ll write you later about few questions!
Hi. I like the way you write. Will you post some more articles?
I think you have already loaded the helper in the autoload , so there is no need to load it again in the controller.
perfect design on zeasite.com thanks