Problem with Date translation in WordPress

So to see how that date_i18n function works you can search for it, then hopefully find the documentation.

That’s here: https://developer.wordpress.org/reference/functions/date_i18n/

It’s technical to read it, but what it says is that the first parameter on the function is not the date you want to translate but the date format that you want the date in, and the second is the time in a timestamp format. (It exlpains that weird output because you’re giving it a date where it’s expecting a date format string)

So what you probably want is:

echo date_i18n($format, $date_obj->getTimestamp());

I didn’t test this, but looking at docs for DateTime here https://www.php.net/manual/en/class.datetime.php , it looks like it should be right.

Post again if it doesn’t work.