update users set data='2018-08-28 12:00:00' where UserId=999929921; update users set data=datetime('2018-08-28 12:00:00') where UserId=999929921; 

It’s like a date, but as soon as you are going to do something with that date, for example, it can take it away from another date, it immediately writes the wrong date format.

How to add time to the database correctly?

  • one
    maybe your question is different - how to subtract another date from date - Alex
  • one
    show the code with which you subtract another date from date - Alex
  • List the structure of your tables with indication of field types . Here is the date you have exactly datetime or something else? And of course, show exactly how you deduct and what you deduct. For example, I do not know such an operation as "subtracting dates" without specifying the type of the result obtained. You can for example find the difference between January 1, 2018 and March 10, 2017 in days or minutes or in other units. But the unit for measuring the date difference will have to be specified ... - Mike
  • I calculate the difference of dates for this query SEC_TO_TIME (UNIX_TIMESTAMP (now ()) - UNIX_TIMESTAMP (users.data)) from users where UserId = 999929921; - Alekseev Stanislav
  • column data has datetime type - Alekseev Stanislav

0