doushe8577
2017-11-14 07:27
浏览 459
已采纳

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

How to display Current date (DD mon YYYY) in HTML, this has to be implemented in Php code

<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>
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

4条回答 默认 最新

  • dongshai8330 2017-11-14 07:35
    已采纳

    Try this:

    n =  new Date();
    y = n.getFullYear();
    m = n.getMonth() + 1;
    d = n.getDate();
    document.getElementById("date").innerHTML = m + "/" + d + "/" + y;
    <p id="date"></p>
    
    点赞 评论
  • douju4594 2017-11-14 07:36
    ...    
    
    str_replace("{current_date}",date("d-m-Y"));
    
    ...
    

    You mean like this ?

    点赞 评论
  • dskm94301 2017-11-14 07:43

    Try this:-

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

    Hope it helps!

    点赞 评论
  • duanbi6522 2017-11-14 08:09

    A bit more strait and simple solution:

    <h3>Attendance : <?=date('d F Y')?></h3>
    
    • F - Full month name
    • M - Short (3 symbols) month name
    • m - month number
    • d - day of month
    • Y - full year
    点赞 评论

相关推荐 更多相似问题