Collections:
Presenting a Past Time in Hours, Minutes and Seconds in MySQL
How To Present a Past Time in Hours, Minutes and Seconds in MySQL?
✍: FYIcenter.com
If you want show an article was posted "n hours n minutes and n seconds ago", you can use the TIMEDIFF(NOW(), pastTime) function as shown in the following tutorial exercise:
SELECT TIMEDIFF(NOW(), '2006-07-01 04:09:49') FROM DUAL; 06:42:58 SELECT TIME_FORMAT(TIMEDIFF(NOW(), '2006-06-30 04:09:49'), '%H hours, %i minutes and %s seconds ago.') FROM DUAL; 30 hours, 45 minutes and 22 seconds ago.
⇒ Extract Unit Values from a Date and Time in MySQL
⇐ Calculating the Difference between Two Time Values in MySQL
2017-12-26, 4654🔥, 0💬
Popular Posts:
How To Generate Random Numbers with the RAND() Function in SQL Server Transact-SQL? Random numbers a...
How To Get the Definition of a View Out of the SQL Server in SQL Server? If you want get the definit...
What Are the Basic Features of a Trigger in SQL Server? Since a SQL Server trigger is a really an ev...
What Is Program Global Area (PGA) in Oracle? A Program Global Area (PGA) is a memory buffer that is ...
What Are Out-of-Range Errors with DATETIME values in SQL Server Transact-SQL? When you enter DATETIM...