PHP: Convert Seconds to Format 00:00:00
Question by Guest | 2014-09-30 at 22:13
I have a time given in seconds (for example 3611) and I would like to output this value in the format 00:00:00 (hours:minutes:seconds), which would be 01:00:11 for 3611. The reason is, that the value should be displayed in a more readable form on my website.
Is there any simple PHP function for a conversion like this?
Related Topics
Website Performance: Caching and Expires Header for Images, CSS and JavaScript
Tutorial | 0 Comments
Convert many CSV Files to XLSX or ODS Spreadsheets
Tutorial | 0 Comments
Delphi/Lazarus: Display current Date and Time
Tip | 0 Comments
PHP: Current Date and Time
Tutorial | 0 Comments
PHP: Upload of large Files
Tutorial | 0 Comments
HTML Form: Redirection depending on Radiobutton or Checkbox State
Tutorial | 0 Comments
XLS and XLSX: Maximum Number of Columns and Rows
Info | 2 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
For example, you can work with the PHP functions date(), sprintf()/printf() or a combination of date() and mktime():
Each of those lines will result in the output "01:00:11".
I have already explained the functionality of the functions used in this example in the answers of this question in detail.
2014-10-01 at 16:17