I want to convert two integer as a time like:
$hour = 13;
$minute = 45;
---> $result = 13:45:00 //(In TimeFormart)
after I combine that i have to do some SQL Querys and PHP Calculations
can somebody help me?
I want to convert two integer as a time like:
$hour = 13;
$minute = 45;
---> $result = 13:45:00 //(In TimeFormart)
after I combine that i have to do some SQL Querys and PHP Calculations
can somebody help me?
Even when your question is very difficult to understand. Nobody knows what exactly you want to do and in which way and volume.
The only correct way to do it is this way:
$hour = 13;
$minute = 45;
$seconds = 0;
$result = date('H:i:s', mktime($hour, $minute, $seconds));
echo $result;
// output: 13:45:00
Important: When using it for making a time, you must pass hour, minute, seconds - if you dont pass seconds it takes the current time seconds.
You can even pass day, month, year for more information check out the PHP Reference. https://www.php.net/manual/de/function.mktime.php
Try this code may be it help you.
<?php
$hour = 13;
$minute = 45;
$second=35;
// $result = 13:45:00 //(In TimeFormart)
$result = $hour.":".$minute.":".$second;
echo $result;
?>
here's what you want, but if you put more than 24
in hour, it'll accept, it just returns you how many hours, minutes and seconds not that actual time
$hour = 13;
$minute = 45;
echo date($hour.':'.$minute.':s');
$hour = 13;
$minute = 45;
$result = $hour . ':' . $minute . ':' . '00';
echo $result;
output---> 13:45:00 //(In TimeFormart)