php - 用树枝比较两个日期
问题描述
我目前正在处理一个活跃的用户概览页面,并且在我被要求提供“最后一个活动列”之前,一切都运行顺利。仅使用日期即可正常运行,但显示的数据应采用“上次活动...分钟前”的形式。现在我面临的问题是我正在运行代码,但我似乎找不到从 currentTime 中减去 lastActivityTime 并将其格式化以显示它的方法。
{% if activeRegularUsers|length > 0 %}
{% for regularUser in activeRegularUsers %}
<tbody>
<tr class="_recolor" id="tableTile">
<td class="uidCell" id="tableTile">{{ regularUser.uid }}</td>
<td class="firstNameCell" id="tableTile">{{ regularUser.firstName }}</td>
<td class="familyNameCell" id="tableTile">{{ regularUser.familyName }}</td>
<td class="unitCell" id="tableTile">{{ regularUser.readableStateName }}</td>
<td class="stateCell" id="tableTile">{{ (dateToday - regularUser.LastActivityAt)|date('H:i:s Y-m-d') }}</td>
</tr>
</tbody>
{% endfor %}
{% else %}
<tbody>
<td colspan="5" class="_recolor">Keine eingeloggten Benutzer in dieser Benutzergruppe.</td>
</tbody>
{% endif %}
可以看出在最后的第一下。
我尝试使用 .format('H:i:s Ymd') 以及 |date 格式化 dateToday 和 LastactivityAt ,但似乎没有任何效果。
我会很感激这方面的领导。先感谢您!
解决方案
推荐阅读
- discord.js - Discord.js 斜线命令类型 5
- python - 使用 Jupyter Notebook 获取 404 GET /contents.js
- java - Java Tesseract 不准确的结果
- linux - 将 find -execdir 与 grep 结合使用
- python - 如何使用 plt.imshow 显示分段图像?
- python - Python函数简单而笨拙
- python - 如何使这两个命令都可以放入 discord.py
- javascript - 如何使用 d3.js 绘制螺旋气泡图
- c++ - 为什么我不能直接将字符串文字作为非类型模板参数传递?
- python - 从 %-style 格式字符串模板中提取键