Wordpress ACF - Date format

吃可爱长大的小学妹 提交于 2020-06-14 19:17:29

问题


I am using the date field to render out the date to look like: 11/15/2014. But I want to also display the date like November 15, 2014 else where on the page. Is it somehow possible to render out the date in two different formats?

<?php the_field('date'); ?>

回答1:


You can use get_field and then you can change the date format to whatever you want.

$date = get_field('date');
$date2 = date("F j, Y", strtotime($date));



回答2:


For 11/15/2014,

the_date('m/d/Y');

And for November 15, 2014,

the_date('F d, Y');


来源:https://stackoverflow.com/questions/26941452/wordpress-acf-date-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!