如何在PHP中添加时间?

时间:2015-05-11 06:24:02

标签: php datetime

我从数据库中获取各种行(该列的格式为datetime),并将其格式化为仅限时间。现在我想将所有行添加到一个PHP变量中,我该如何实现呢?

// Caching
var $tagsLeft = $('#tags-left'),
    $tagDiv = $('#tag-div');
var tagLeftWidth,
    tagDivWidth;

$("#show-tag").on('click', function () {
    var $this = $(this);
    $this.prop('disabled', true).addClass('disabled'); // Disable the button
    tagLeftWidth = $tagDiv.width() ? '90%' : '45%';
    tagDivWidth = $tagDiv.width() ? '0%' : '45%';

    $tagDiv.animate({
        'width': tagDivWidth
    }, function() {
        $this.prop('disabled', false).removeClass('disabled'); // Enabling button
    });

    $tagsLeft.animate({
        'width': tagLeftWidth
    });
});

1 个答案:

答案 0 :(得分:0)

这可能会对你有所帮助

public function fetchTime(){
    $catch = "";
    $db = $this->getConn();
    $statement = $db->prepare("SELECT log_in FROM attendance");
    $statement->execute();
    while ($result = $statement->fetch()){
       $catch.= $result[0]; //This is the part where I do not know how to add time
    }
    return $catch;

 }