Getting Hour and Minute in PHP

前端 未结 7 1305
既然无缘
既然无缘 2020-12-05 09:43

I need to get the current time, in Hour:Min format can any one help me in this.

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-05 09:48

    function get_time($time) {
        $duration = $time / 1000;
        $hours = floor($duration / 3600);
        $minutes = floor(($duration / 60) % 60);
        $seconds = $duration % 60;
        if ($hours != 0)
            echo "$hours:$minutes:$seconds";
        else
            echo "$minutes:$seconds";
    }
    
    get_time('1119241');
    

提交回复
热议问题