Format

Formats the date value.
 
SELECT DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y');

    -> 'Sunday October 2009'

String to Date / String

This is the inverse of the DATE_FORMAT() function.
 
SELECT STR_TO_DATE('01,5,2013','%d,%m,%Y');

        -> 2013-05-01

Get date format / Get

Returns a format string from current date. Useful in combination with the DATE_FORMAT() and the STR_TO_DATE() functions.
 
SELECT DATE_FORMAT('2003-10-03', GET_FORMAT(DATE, 'EUR'));

        -> '03.10.2003'






Questions and answers:
Clink on Option to Answer




1. Get date from string

  • a) SELECT {{STR_TO_DATE}}('01,5,2013','%d,%m,%Y');
  • b) SELECT {{DATE_FORMAT}}('01,5,2013','%d,%m,%Y');

2. Get USA date format

  • a) SELECT {{GET_FORMAT}}(DATE,'USA');
  • b) SELECT {{DATE_FORMAT}}(DATE,'USA');


References: