set timezone in codeigniter – how to set timezone in codeigniter?

set timezone in codeigniter – PHP date_default_timezone_set() function is used to sets the default timezone used by all date or time functions.

How to set timezone in codeigniter?

To set default timezone in PHP Codeigniter, you can add the simple PHP method Like date_default_timezone_set() function in your application/config.php or index.php file.

You are required to use the date.timezone setting or the date_default_timezone_set() function.

date_default_timezone_set(‘asia/kolkata’) in codeigniter

Codeigniter | Set timezone

date_default_timezone_set('your timezone');

EXAMPLE

<?php
// Set India timezone
date_default_timezone_set('Asia/Kolkata');
?>

application/config/config.php

<?php

defined('BASEPATH') OR exit('No direct script access allowed');

date_default_timezone_set('Asia/Kolkata');

date_default_timezone_set for india in php laravel

config/app.php

 replace timezone
 'timezone' => 'Asia/Kolkata'

date_default_timezone_set for india in php

<?php
	date_default_timezone_set("Asia/Kolkata");   //Set India time (GMT+5:30)
	echo date('d-m-Y H:i:s');
?>

PHP List of Supported Time Zones : PHP DateTimeZone

I hope you get an idea about set timezone in codeigniter.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Also Read This 👉   javascript concatenate string and variable