expression - 我想要这个查询的不同答案
问题描述
对此查询的长输出感到困惑: new Date(); 有人可以缩短输出,以便我得到这 3 个不同的语句:
1.Date fx.(20 Apr)
2.Date & FullYear fx.(20 Apr 2020)
3.Time fx.(10:10:00)
非常感谢将不胜感激:)
解决方案
只需阅读:https ://www.php.net/manual/en/datetime.formats.date.php
$date = new DateTime('now');
$date = $date->format('H:i:s');
$month = new DateTime('now');
$month = $month->format('d M');
$full_year = new DateTime('now');
$full_year = $full_year->format('d M Y');
echo '<pre>TDate fx.('; print_r($month); echo ')<br />';
echo 'Date & FullYear fx.('; print_r($full_year); echo ')<br />';
echo 'Time fx.('; print_r($date); echo ')</pre>';
推荐阅读
- typescript - 为什么索引签名参数类型不能扩展字符串或数字?
- python - 使用重复索引号对索引顺序进行排序
- python - QRegularExpression 如何传递给 Qt::MatchRegularExpression
- android-databinding - 为什么我的数据绑定注解(@BindingAdapter("imageURL")) 不起作用?
- c# - 使用 MailKit 和 Stringbuilder 发送 ics 文件
- python - 通过键合并两个 Python 字典的值
- angular - Validators.minlength 不能以角度反应形式工作
- cucumber - 如何将空手道测试结果输出到自定义文件夹而不是目标?
- firebase - 如何创建水平 ListView.builder
- node.js - 如何使用 fastify-cors 让一个 api 跨域?