RBA Cash Rate: 4.35% · 1AUD = 0.67 USD · Inflation: 4.1%  
Leading Digital Marketing Experts</strong | 1300 235 433 | Aggregation Enquires Welcome | Book Appointment
Example Interest Rates: Home Loan Variable: 5.69% (5.89%*) • Home Loan Fixed: 5.39% (5.84%*) • Fixed: 5.39% (5.84%*) • Variable: 5.69% (5.89%*) • Investment IO: 5.69% (6.19%*) • Investment PI: 5.49% (5.98%*)

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: 1 · [ CHANGE ]

Like this article?

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

Leave a comment