Jquery Timeago在标题中添加AM/PM

Jquery Timeago add AM/PM in title

本文关键字:AM PM 添加 Timeago 标题 Jquery      更新时间:2023-09-26

我使用Timeago插件来替换日期和时间2分钟前。在我实现之后用我的PHP代码:

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-timeago/0.9.3/jquery.timeago.js" type="text/javascript"></script>
<script>
  jQuery(document).ready(function() {
    jQuery("abbr.timeago").timeago();
  });
</script>
<abbr class="timeago ticket_date" title="<?= date("Y-m-d  h:i:s A", strtotime($ticket_row_message['date_added'])); ?>"><?= date("Y-m-d  h:i:s", strtotime($ticket_row_message['date_added'])); ?></abbr>

我发现的问题是当我将鼠标悬停到abbr时,标题只显示2013-03-14 11:06:44而没有AM PM。那么如何添加AM PM,有什么技巧吗?

这确实是一个PHP问题。第一个是使用:

<?= date("Y-m-d  h:i:s A", strtotime($ticket_row_message['date_added'])); ?>

你的第二个是使用:

<?= date("Y-m-d  h:i:s", strtotime($ticket_row_message['date_added'])); ?>

把"A"也加到第二个