• Hey

    It was sent as Thai, but now it appears 2018.
    setlocale(LC_TIME, “th_TH.UTF-8”);
    echo strftime(“%A %e %B %Y”);

    Yes, it says now 2017, but that is now only english
    echo get_the_date(“l j. F Y”); //WordPress

    Why does this happen?

Viewing 5 replies - 1 through 5 (of 5 total)
  • w

    (@woptimize)

    strftime gives your the current time, while get_the_date gives you the publishing date of the post.

    Thread Starter TheDani

    (@thedani)

    yes, but why?
    strftime in thai, but 2018.
    get_the_date to 2017, but English.
    I want give it to thai, and 2017.

    get_the_date ignores php locales (it uses probably lang settings from admin panel).

    You can try this solution:

    setlocale(LC_TIME, “th_TH.UTF-8”);
    echo strftime("%A %e %B %Y", get_post_time('U'));

    or You can set thai language for the whole site in admin panel.

    Thread Starter TheDani

    (@thedani)

    Thank you ??

    Thread Starter TheDani

    (@thedani)

    “?????? ??? 2 ?????? ?.?. 2016”, how much I can add with “?????? ??? ? ?????? ?.?. ????” and with 2559 to ?????

    • This reply was modified 6 years, 8 months ago by TheDani.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘strftime() and get_the_date(), what is wrong?’ is closed to new replies.