Support

Account

Home Forums General Issues How to change date format to native language?

Solving

How to change date format to native language?

  • Hey everyone, I’m new to AFC and not much of a developer, so any help is tremendously appreciated

    How do I display the date format to my native language, Danish?
    Quite simple, I seek to display a event date like “31. May” in Danish like “31. Maj”.

    I have followed the instructions in the documentation, or at least I think I have, without any change:
    https://www.advancedcustomfields.com/resources/date-picker/ #Translations

    I placed the code into the single php file for the event type, but to no avail. What should I do instead?

  • Hi @run4it

    Would you mind sharing a copy of the code that you have so far so that I can help in spotting any errors?

  • Hi James

    I’m sure the error lies with me and where I’ve place the code.
    Here is the code I’ve placed in the bottom of the ‘functions php’ file and later in the ‘single event php’ file.

    <?php
    $dateformatstring = “l d F, Y”;
    $unixtimestamp = strtotime(get_field(‘concert_date’));
    echo date_i18n($dateformatstring, $unixtimestamp);
    ?>

    OTHER INFO
    Field name: concert_date
    Wp framework: divi builder
    Plugin for ACF displaying: ACF injector
    Web site language: da_DK

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘How to change date format to native language?’ is closed to new replies.