RBA Cash Rate: 4.35% · 1AUD = 0.67 USD · Inflation: 4.1%  
Leading Digital Marketing Experts | 1300 235 433 | Aggregation Enquires Welcome | Book Appointment
Example Interest Rates: Home Loan Variable: 5.20% (5.24%*) • Home Loan Fixed: 5.48% (6.24%*) • Fixed: 5.48% (6.24%*) • Variable: 5.20% (5.24%*) • Investment IO: 5.78% (6.81%*) • Investment PI: 5.49% (6.32%*)

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.

  E. Australia Standard Time [ UTC+10, Default ] [ CHECK TO CHANGE ]

  Want to have a chat?
 

Like this article?

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

Leave a comment