Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.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 如何在HTML中显示当前日期?_Php_Html - Fatal编程技术网

Php 如何在HTML中显示当前日期?

Php 如何在HTML中显示当前日期?,php,html,Php,Html,如何在HTML中显示当前日期(DD-mon-YYYY),这必须在Php代码中实现 <div class="container-fluid" style="padding: 0rem 1rem;"> <h3>Attendance : {current_date} </h3> <hr> <p id="Page_MsgBox" style="padding: 0rem 1rem;"></p> <div cla

如何在HTML中显示当前日期(DD-mon-YYYY),这必须在Php代码中实现

<div class="container-fluid" style="padding: 0rem 1rem;">
  <h3>Attendance : {current_date} </h3>
  <hr>
  <p id="Page_MsgBox" style="padding: 0rem 1rem;"></p>
  <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 col-xl-12">
    {$attendance_table}
  </div>
</div>

出席人数:{当前日期}

{$attention_table}
试试这个:

n =  new Date();
y = n.getFullYear();
m = n.getMonth() + 1;
d = n.getDate();
document.getElementById("date").innerHTML = m + "/" + d + "/" + y;
<p id="date"></p>
n=新日期();
y=n.getFullYear();
m=n.getMonth()+1;
d=n.getDate();
document.getElementById(“日期”).innerHTML=m+“/”+d+“/”+y;

你是说像这样吗?

试试这个:-

<h3>Attendance : <?php echo date('d M Y'); ?></h3>
出席人数:

希望有帮助

更为简单的解决方案:

<h3>Attendance : <?=date('d F Y')?></h3>
出席人数:
  • F-完整的月份名称
  • M-短(3个符号)月份名称
  • 月数
  • d-月日
  • Y-全年
<h3>Attendance : <?=date('d F Y')?></h3>