1

As an example, after update 4.9.5, my wordpress site outputs this timestamp in timezone settings: 2018-04-05 (5th of april)

My site is set to Danish, and in Denmark the timeformat is dd/mm. The dateformat is correct, byt why does it output the opposite in timezone?

It means, that i have a form where you submit a date, but it's switched around when it's submitted. If you choose 1st of july, it then posts 07/01 instead of 01/07.

I've tried researching, but can't seem to find the solution for this.

Hope you can help.

5
  • Have you double-checked your date format in wp-admin Settings screen, as well as any places in plugins that may have date settings, like your form? Some plugins have settings for the way dates are input, displayed, and stored.
    – WebElaine
    Apr 5, 2018 at 14:18
  • Is the form field a HTML5 Date field?
    – xsonic
    Apr 5, 2018 at 14:35
  • Yes, i’ve double checked it. The dateformat preview in settings is dd/mm like it should be, but the timezone preview is mm/dd ? - The plugin setting for the form is also dd/mm. I don’t know how to check if it’s HTML5 date field ? Apr 5, 2018 at 14:35
  • That example is not a date or a time, it's a timestamp and timestamps have standardised formats
    – Tom J Nowell
    Apr 5, 2018 at 14:49
  • If this occurred as a result from an upgrade to 4.9.5, that sounds like a bug introduced in WordPress core. Apr 5, 2018 at 15:04

1 Answer 1

2

If it is the example in the timezone settings you're referring to here:

enter image description here

Then this is expected behaviour, and is correct by definition according to ISO standards, because this is not the time, it's a timestamp.

This way there is no ambiguity about the time being referenced, and it's the only place in WordPress where a timestamp is used in the admin UI. As such it does not follow the date format settings or the time format settings, because it isn't a formatted date/time, it's a timestamp. Timestamps have standardised formats

Because the americans insisted on MM/DD/YYYY, and the rest of the world uses DD/MM/YYYY, everybody got together in 1988 and it was agreed that the canonical correct universal format was YYYY/MM/DD, aka ISO_8601 for which there was no ambiguity. A number of other date standards were replaced at the same time

As it's a timestamp, it takes that format. Unless you're displaying full timestamps on the frontend though, this is the only place it will appear in that format

For more information, refer to https://en.wikipedia.org/wiki/ISO_8601

Specifically the section on calendar dates

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.