v.23.2Improvement
Add DATE_FORMAT() alias for formatDateTime() to enhance MySQL compatibility
Add an alias "DATE_FORMAT()" for function "formatDateTime()" to improve compatibility with MySQL's SQL dialect, extend functionformatDateTimewith substitutions "a", "b", "c", "h", "i", "k", "l" "r", "s", "W". ### Documentation entry for user-facing changes User-readable short description:DATE_FORMATis an alias offormatDateTime. Formats a Time according to the given Format string. Format is a constant expression, so you cannot have multiple formats for a single result column. (Provide link to formatDateTime). #46302 (Jake Bamrah).
Why it matters
This feature improves compatibility with MySQL's SQL dialect by providing an alias forformatDateTime() named DATE_FORMAT(). It enhances usability for users migrating queries from MySQL or working across different SQL dialects by supporting familiar function naming and extending the formatting options with additional substitutions.How to use it
Use theDATE_FORMAT() function in the same way as formatDateTime() by providing a date/time value and a constant format string. For example:SELECT DATE_FORMAT(now(), '%Y-%m-%d %H:%i:%s')The format string must be a constant expression, so different formats require separate expressions or queries.