I need to print the number in one font, and the year in another
<?php $timestamp = get_field('date_time'); ?>
How to do it . help me please
I need to print the number in one font, and the year in another
<?php $timestamp = get_field('date_time'); ?>
How to do it . help me please
Share Improve this question edited Sep 3, 2019 at 10:27 Chetan Vaghela 2,4084 gold badges10 silver badges16 bronze badges asked Sep 3, 2019 at 6:45 KaizerKaizer 111 bronze badge 2 |1 Answer
Reset to default 0Here you can get separated data from timestamp using date();
function. you can apply different fonts each value.
<?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;
?>
if $timestamp
value "1567503270
" then output will be below.
Output :
Day : 03
Month : 09
Year : 2019
if get_field('date_time')
return 15 june, 2019
then its timestap will be 1560629940
. see below code for reference.
$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
date()
documentation, php/manual/en/function.date.php. And please note that 3rd party plugins, such as ACF, are considered off-topic here on WPSE. It is highly recommended to contact the plugin author should you have any questions regarding the use and/or configuration of the plugin. – Antti Koskinen Commented Sep 3, 2019 at 9:14