Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/239.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如果创建日期和本地日期相同,则显示图标 刚出现的_Php_Html - Fatal编程技术网

Php 如果创建日期和本地日期相同,则显示图标 刚出现的

Php 如果创建日期和本地日期相同,则显示图标 刚出现的,php,html,Php,Html,基本上,当今天创建日期时,它应该显示“新建”图标。它们都在回显相同的日期,但跨度没有显示请尝试使用以下方法: <?php date_default_timezone_set('America/New York'); $servermonth = date('m/d/Y ', time()); $createdate = new DateTime($row['createdon']); $newdateformat =$createdate->form

基本上,当今天创建日期时,它应该显示“新建”图标。它们都在回显相同的日期,但跨度没有显示

请尝试使用以下方法:

<?php
    date_default_timezone_set('America/New York');
    $servermonth = date('m/d/Y ', time());

    $createdate = new DateTime($row['createdon']);
    $newdateformat =$createdate->format('m/d/Y') ;

    // echo $newdateformat;
    //  echo $servermonth;  
    if (servermonth == newdateformat) { 
?>
      <span class="label label-default">New</span> 
<?php  
    } 
?>
if(strotime(servermonth)==strotime(newdateformat)){
呼应"新",;
}
尝试使用以下方法:

<?php
    date_default_timezone_set('America/New York');
    $servermonth = date('m/d/Y ', time());

    $createdate = new DateTime($row['createdon']);
    $newdateformat =$createdate->format('m/d/Y') ;

    // echo $newdateformat;
    //  echo $servermonth;  
    if (servermonth == newdateformat) { 
?>
      <span class="label label-default">New</span> 
<?php  
    } 
?>
if(strotime(servermonth)==strotime(newdateformat)){
呼应"新",;
}
它应该是:

if (strtotime(servermonth) === strtotime(newdateformat)) {
   echo '<span class="label label-default">New</span>';
}

它应该是:

if (strtotime(servermonth) === strtotime(newdateformat)) {
   echo '<span class="label label-default">New</span>';
}


刚出现的

刚出现的