0

I'm archiving website events, and want to store times for when things happen.

My server is set to UTC.

I want them to be saved in the database in the user's time, so if someone in the UK does something at 7:30pm on Dec 14 2015, I want it to look like:

2015-12-14 19:30:00

or preferably

2015-12-14 19:30pm

However, when I test here in Australia, it saves my time in UTC time for both DATETIME and TIMESTAMP

eg if I do something my time 6pm, it saves it as 8am.

I don't want it in UTC - I want it saved as their time, so when browsing the db, I can see what time their activity occurred in their timezone, without having to know what their timezone was.

To do this, do I have to use something client side to get their local time or timezone, or is there something in php that can figure out which timezone they are in, so I can get a time() value and adjust it before archiving?

Thanks for your time and help.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Shaun
  • 2,043
  • 3
  • 27
  • 36
  • It would definitely have to involve something client side because the server does not know the timezone the client is in. [see this answer for how to get the client's timezone in php](http://stackoverflow.com/questions/1905397/how-to-get-clients-timezone) – Thawn Nov 26 '15 at 07:16
  • https://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html – Strawberry Nov 26 '15 at 08:26

0 Answers0