Home Forums ACF PRO Output localized date in a customized format


Output localized date in a customized format

  • Hello,

    I’m using a Date Picker field to save a date value.

    I can output the field value with get_field, but if I want to output a customized output localized I didn’t find any solution.

    I want to output the day first, then month+year in custom HTML. I tried to use DateTime::createfromFormat which is working but is outputing an english version of the date.

    if($full_date = get_field('date')):
    	$day_from_date = DateTime::createFromFormat('d/m/Y', $full_date)->format('d');
    	$monthyear_from_date = DateTime::createFromFormat('d/m/Y', $full_date)->format('M Y');
    	echo $day_from_date ;
    	echo $monthyear_from_date ;

    How can I output the localized version for a customized output date ?
    Thank you in advance.


Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.