Is there any particular reason to store user's timezone when I have already stored user's local time and UTC time - PHP/MYSQL?

29
January 13, 2019, at 05:40 AM

I was wondering why should i need to store user's timezone as many suggested when I have two columns already in my db table local_datetime and utc_datetime which are used to show how long ago a comment was posted. I can use the utc_datetime and convert it to user's local time and the local_datetime helps me sorting results by a particular day for a user. So my question is, what is the purpose of storing timezone??

Answer 1

When you stored user's UTC time, it does not require any other parameters. That moment was same allover the world. If you want to know where that user came from, only then you need to store his/her timezone. Your use case seems to just calculate elapsed time you can do it by generating the time difference from stored UTC time and current UTC time.

READ ALSO
Union working in localhost MySQL Version 5.5.8 but not working on server MySQL - 5.7.24

Union working in localhost MySQL Version 5.5.8 but not working on server MySQL - 5.7.24

I have a table in which i am fetching Left & Right child of Parent via union query but there is a problem its working fine on localhost but union query fetch only first select statement on live server

43
Is there any Filtering query in Mysql to sorty by relevance?

Is there any Filtering query in Mysql to sorty by relevance?

Is there any way to write a filtering query for the following scenario in mysql

20
Database design for B2B2C system

Database design for B2B2C system

I want to create an application, where my direct clients are business personThey would use the application to make transactions with their customers

21
i can't get the following $resultCheck to redirect

i can't get the following $resultCheck to redirect

I have the following code and it is displaying the select tag options as $level1promo_competition based on what is in my databaseThe thing that is puzzing me is that if I changed the name in my database or my variable to something else other than what is in my database,...

35