Php 如何格式化时间戳以仅显示日期而不显示时间

Php 如何格式化时间戳以仅显示日期而不显示时间,php,mysql,datetime,timestamp,Php,Mysql,Datetime,Timestamp,嗨,我在MySQL中存储了时间戳,当我回显时,在更新当前时间戳上有这个属性。给我日期和时间。我怎么能只显示日期而不显示时间呢。 这次显示数据包含在数据库中的日期和时间我有这个代码 if (php_sapi_name() == 'apache') { // if our web server is apache // we get check HTTP // If-Modified-Since header // and do not send image

嗨,我在MySQL中存储了时间戳,当我回显时,在更新当前时间戳上有这个属性。给我日期和时间。我怎么能只显示日期而不显示时间呢。 这次显示数据包含在数据库中的日期和时间我有这个代码

if (php_sapi_name() == 'apache') {
    // if our web server is apache
    // we get check HTTP
    // If-Modified-Since header
    // and do not send image
    // if there is a cached version

    $ar = apache_request_headers();
    if (isset($ar['If-Modified-Since']) && // If-Modified-Since should exists
        ($ar['If-Modified-Since'] != '') && // not empty
        (strtotime($ar['If-Modified-Since']) >= $image_time)) // and grater than
        $send_304 = true;                                     // image_time
}


if ($send_304)
{
    // Sending 304 response to browser
    // "Browser, your cached version of image is OK
    // we're not sending anything new to you"
    header('Last-Modified: '.gmdate('D, d M Y H:i:s', $ts).' GMT', true, 304);

    exit(); // bye-bye
}

// outputing Last-Modified header
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $image_time).' GMT',
        true, 200);

// Set expiration time +1 year
// We do not have any photo re-uploading
// so, browser may cache this photo for quite a long time
header('Expires: '.gmdate('D, d M Y H:i:s',  $image_time + 86400*365).' GMT',
        true, 200);

我试图删除H:i:s,但没有更改为输出我如何更改它

删除
H:i:s
将更改输出,我怀疑您更改了错误的内容

d/m/Y H:i:s
将输出
01/01/2014 00:00:00


d/m/Y
将输出
01/01/2014

删除
上的参数
H:i:s
。gmdate
函数

在检索日期时间时使用mysql中的日期函数field@ArefMakke我怀疑你对这个答案投了更高的票,这很好,但是如果这个问题没有包含一个“接受的答案”,那么这个问题看起来就没有解决. 请将此答案授予绿色勾号,以作为第一个帮助/正确答案。