在这里,您可以使用date();
作用您可以为每个值应用不同的字体。
<?php
$timestamp = get_field(\'date_time\');
$day = date(\'d\', $timestamp);
$mon = date(\'m\', $timestamp);
$year = date(\'Y\', $timestamp);
echo "Day : ".$day."<br>";
echo "Month : ".$mon."<br>";
echo "Year : ".$year;
?>
如果
$timestamp
“值”
1567503270
“然后输出将低于。
Output :
Day : 03
Month : 09
Year : 2019
如果
get_field(\'date_time\')
回来
15 june, 2019
那么它的timestap将是
1560629940
. 参考以下代码。
$timestamp = strtotime("15 june, 2019");
$day = date(\'d\', $timestamp);
$mon = date(\'m\', $timestamp);
$year = date(\'Y\', $timestamp);
echo "timestamp : ".$timestamp."<br>";
echo "Day : ".$day."<br>";
echo "Month : ".$mon."<br>";
echo "Year : ".$year;
**Output**
timestamp : 1560629940
Day : 15
Month : 06
Year : 2019