Doug Wolfgram
Doug Wolfgram

Reputation: 2126

How do I simply set the user's timezone in CodeIgniter for all SELECTs

I am running MYSQL in UTC by default. I want all selects to be done in the user's local time, but all inserts and updates to be in UTC. How do I do this? I know of the CONVERT_TZ function, but I don't want to have to wrap every select if at all possible. Is there a way to set the users timezone ONCE after they log in? I am using CodeIgniter and non-persistent so I assume I have to set it every time I connect?

Any advice is appreciated.

Upvotes: 0

Views: 240

Answers (1)

Simone
Simone

Reputation: 656

in Your index.php file in the root Folder use:

date_default_timezone_set('Asia/Kolkata');

And Set your time zone here. All codeigniter Requests pass through this file. So it will set Your time Zone

Upvotes: 1

Related Questions