Home >Backend Development >PHP Problem >How to convert time to seconds in php
How to implement php time to seconds: First create a PHP sample file; then pass "$parsed['hour'] * 3600 $parsed['minute'] * 60 $parsed['second']; " method to convert the specified time into seconds.
Recommendation: "PHP Video Tutorial"
Convert the time string in HH:MM:SS format into Seconds, you can use the date_parse function to parse specific time information.
<?php $time = '21:30:10'; $parsed = date_parse($time); $seconds = $parsed['hour'] * 3600 $parsed['minute'] * 60 $parsed['second']; echo $seconds; ?>
The above is the detailed content of How to convert time to seconds in php. For more information, please follow other related articles on the PHP Chinese website!