RBA Cash Rate: 4.35% · 1AUD = 0.71 USD · Inflation: 4.2%  
Leading Digital Marketing Experts | 1300 235 433 | Aggregation Enquires Welcome | Book Appointment
Example Interest Rates: Home Loan Variable: 5.80% (5.85%*) • Home Loan Fixed: 6.04% (6.83%*) • Fixed: 6.04% (6.83%*) • Variable: 5.80% (5.85%*) • Investment IO: 6.19% (6.22%*) • Investment PI: 6.04% (5.95%*)

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 complimentary 650-page guide on marketing for mortgage brokers. We'll show you exactly how we generate billions in volume for our clients.
Finance Guide, Cropped Top and Bottom
Timezone: E. AUSTRALIA STANDARD TIME · [ CHANGE ]

Like this article?

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

Leave a comment