Change the time zone in Codeigniter

前端 未结 7 1140
遇见更好的自我
遇见更好的自我 2021-01-11 10:37

my project is hosted on shared server and i want to change the timezone to Asia/Kolkata. i have tried setting timezone using htaccess file but failed.

相关标签:
7条回答
  • 2021-01-11 11:06

    Yeah thanks, i try in my controller like this :

    if (!defined('BASEPATH'))
        exit('No direct script access allowed');
    /*
     * Description of Testime
     * @class Testing
     */
    
    class Testing extends CI_Controller {
    
        public function __construct() {
            parent::__construct();
            date_default_timezone_set('Asia/Jakarta');
        }
    
        public function index(){
            echo date('Y-m-d H:i:s');
        }
    }
    

    And works :)

    0 讨论(0)
提交回复
热议问题