문제

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.

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top