Make WordPress Core

Opened 4 years ago

Last modified 15 months ago

#48936 new enhancement

Remove mysql2date() usage from core

Reported by: rarst's profile Rarst Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Date/Time Keywords: needs-patch needs-unit-tests
Focuses: Cc:


mysql2date() was originally meant from processing times as stored by WP in database.

Unfortunately its design is very limited because both time zone of input and output is ambiguous. It is interchangeably used for local and UTC times.

As implementation detail that meant that it would produce incorrect output for formats including time zones for local time inputs. Time zone would happen be UTC from WP core setting PHP time zone to UTC on load.

In 5.3 release this behavior was flipped to produce correct local time output for local time input, as considerably more common. Accordingly now UTC input produces incorrect output for formats with time zone.

While the function is common and familiar, it is hardly irreplaceable and its design is so limited it seems to be unsalvageable.

I propose we move towards eliminating its use in core and eventually formally deprecating it.

Change History (2)

#1 @Rarst
4 years ago

  • Type changed from defect (bug) to enhancement

#2 @coquardcyr
15 months ago

Inside the core, we have the following usages from the function:

Last edited 15 months ago by coquardcyr (previous) (diff)
Note: See TracTickets for help on using tickets.