RBA Cash Rate: 4.35% · 1AUD = 0.67 USD · Inflation: 5.4%  
Leading Digital Marketing Experts | 1300 235 433 | Aggregation Enquires Welcome | Book Appointment
Example Interest Rates: Home Loan Variable: 5.00% (5.13%*) • Home Loan Fixed: 5.39% (6.11%*) • Fixed: 5.39% (6.11%*) • Variable: 5.00% (5.13%*) • Investment IO: 5.59% (7.06%*) • Investment PI: 5.10% (6.04%*)

Convert Seconds to HH:MM:SS

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

1
$result = gmdate('H:i:s', ($seconds));

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

1
$result = gmdate('H:i:s', ($seconds)) . 's';

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

1
$result = ltrim(gmdate('H:i:s', ($seconds)), '00:') . 's';

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:

1
$result = ltrim(gmdate('H:i:s', ($seconds)), '00:00:') . 's';

■ ■ ■

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

Download our 650-page guide on Finance Marketing. We'll show you exactly how we generate Billions in volume for our clients.

  AUS Eastern Standard Time (Connecticut)

  Want to have a chat?
 

Like this article?

Share on Facebook
Share on Twitter
Share on Linkdin
Share on Pinterest

Leave a comment