There is a mysql database which contains an order table.
There is a column in this table, the creation time is 16:52.
How to make js timer to calculate how long ago the order was created? Maybe someone has examples?
There is a mysql database which contains an order table.
There is a column in this table, the creation time is 16:52.
How to make js timer to calculate how long ago the order was created? Maybe someone has examples?
The easiest way is to get the Unix Timestamp using the corresponding function in MySQL. If we take away the current timestamp from this number, we get the time in seconds since the record was created in the database. You can get the current timestamp in JavaScript like this:
Math.floor(Date.now() / 1000) Then you can apply the finished code from this question.
Source: https://ru.stackoverflow.com/questions/932900/
All Articles