See what the manual should say NOW () :
Returns the current date and time as a value in 'YYYY-MM-DD HH: MM: SS' or YYYYMMDDHHMMSS.uuuuuu, depending on whether this function is used in a string or numeric context. The value is expressed in the current time zone .
... and UNIX_TIMESTAMP () :
If called without an argument, returns a Unix timestamp (seconds from '1970-01-01 00:00:00' UTC) as an unsigned integer. If UNIX_TIMESTAMP () is called with the date argument, it returns the value of the argument as seconds from '1970-01-01 00:00:00' UTC. the date can be a DATE string, a DATETIME string, TIMESTAMP, or a number in the format YYMMDD or YYYYMMDD. The server interprets the date as the value in the current time zone and converts it to an internal value in UTC format.
So, for starters, they return different things: the correct date and an integer.
You really need to get three functions:
- Save all dates in the same format (UTC or server time zone)
- Get user timezone
- Display saved date in user time zone
The date and time functions in the chapter offer a summary of the available functions. If you want to store dates in UTC, you must go UTC_TIMESTAMP () . If you want to use the server time zone, you can use NOW () . And CONVERT_TZ () to do conversions.
MySQL, however, will not help you with point 2. You need to either ask the user or use JavaScript to read the user clock and send it to the server so you can guess (if you do not ask, you always need to guess, because usually there are several time zones that use the same time in this moment).
source share