PHP, Codeigniter: How to Set Date/Time based on users timezone/location globally in a web app?

Posted by Abs on Stack Overflow See other posts from Stack Overflow or by Abs
Published on 2010-02-16T16:47:20Z Indexed on 2010/03/25 12:23 UTC
Read the original article Hit count: 639

Filed under:
|
|
|

Hello all,

I have just realised if I add a particular record to my MySQL database - it will have a date/time of the server and not the particular user and where they are located which means my search function by date is useless! As they will not be able to search by when they have added it in their timezone rather when it was added in the servers timezone.

Is there a way in Codeigniter to globally set time and date specific to a users location (maybe using their IP) and every time I call date() or time() that users timezone is used.

What I am actually asking for is probably how to make my application dependent on each users timezone?

Maybe its better to store each users timezone in their profile and have a standard time (servers time) and then convert the time to for each user?

Thanks all

© Stack Overflow or respective owner

Related posts about php

Related posts about datetime