adding two time values of similar formats using php

前端 未结 7 880
轮回少年
轮回少年 2020-12-03 11:41

i have two time values as give below

$time  = 06:58:00;
$time2 = 00:40:00;

I am doing this for calculating the appointments and available

7条回答
  •  情歌与酒
    2020-12-03 12:12

    If you're build those time strings from a database before, you'd probably want to rebuild them to something like this:

    $time = "00:06:58";
    $time2 = "40 minutes";
    
    $timestamp = strtotime($time." +".$time2);
    $endTime = date("d.m.Y H:i:s", $timestamp);
    

提交回复
热议问题