M
M
Miku Hatsune2015-11-09 22:09:24
PHP
Miku Hatsune, 2015-11-09 22:09:24

Is there a built-in function in PHP that can convert seconds to hh:mm:ss and vice versa?

Of course, you can calculate "manually", but as for me, this is a bicycle, since 99% of the confidence that there is a ready-made solution.
Does PHP have a function that can do what I need?
// I understand that there is documentation , but there are a lot of functions there and it's just too lazy to search through them all.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivanq, 2015-11-09
@Hatsune-Miku

Yes ... They don’t look at the documentation anymore ...

$date = "hh:mm:ss"; // Подставить время

$timestamp = date_create_from_format("H:i:s", $date)->getTimestamp();
echo $timestamp;

$date = date("H:i:s", $timestamp);
echo $date;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question