首页 > 解决方案 > 我想要这个查询的不同答案

问题描述

对此查询的长输出感到困惑: new Date(); 有人可以缩短输出,以便我得到这 3 个不同的语句:

1.Date fx.(20 Apr)
2.Date & FullYear fx.(20 Apr 2020)
3.Time fx.(10:10:00)

非常感谢将不胜感激:)

标签: expressionadobe

解决方案


只需阅读: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>';

推荐阅读