and like us on FB

The following will convert seconds to an HH:MM:SS format.

To add the ‘s’ for seconds (it puts the time into perspective), use:

For anything under a minute, you might want to strip the leading 00:00.

While printing an ‘s’ gives the time a reference, you might want to keep the leading 00: at times even when there’s no hour. Use the following:

■ ■ ■

Reference: PHP Manual, time() and date() .

Shortt URL for this post: