Hey there guys,
I’m using the PHP DateTime object from Date Piker Value and I would like the output date to be in spanish.
/*
* Create PHP DateTime object from Date Piker Value
* this example expects the value to be saved in the format: yymmdd (JS) = Ymd (PHP)
*/
$date = DateTime::createFromFormat('Ymd', get_field('date_picker'));
echo $date->format('d-m-Y');
Any directions or example code would be very much appreciated,
thanks!
Hi @angel.meraz
Thanks for the question. A previous topic covers this pretty well:
http://support.advancedcustomfields.com/forums/topic/date-picker-language-front-end/
Let me know how you find that article.
THanks
E
Thanks for pointing me in the right direction.
Implementation is really easy, this is what I ended up uisng:
$date = date_i18n("l d F, Y", strtotime(get_field('date_picker')));
echo $date;
Cheers!
Hi @angel.meraz
Awesome! Glad you got it working and thanks for the solution code. I’ll test this out and add it to the docs
Thanks
E