1.date--> String
Functions used: Date_format (date,format) Date: Dates to convert format: formatted style
Format Style collation:
Year: %Y display four-bit: %Y only show the latter two bits: 15
Month: %M Month in English display: October %M Month Arabic display: 01-12 %b Month in English thumbnail display: Oct %c Month Arabic display: 1-12
Day: %d Arabic display: 00-31 %d with English suffix: 1st-31th %e Arabic display: 1-31 %j days: 001-3 66
When: %H : 00-23 %H: 01-12 %I: 01-12 %k: 0-23 %l: 1-12
Points: %i: 00-59
Seconds: %s: 00-59 %s: 00-59
Subtlety: %f
AM/PM:%p
12-hour time:%r: 02:02:44 PM
24-hour time: %T: 14:02:44
Week: %W: Week's English display %W week Arabic display: 0 (Sunday)-6 (Saturday) %a Week's English thumbnail display: mon-
Eg:date_format (now (), "%y-%m-%d%T") 2015-09-01 17:10:52
Date_format (now (), "%y-%m-%d%h:%i:%s%p") 2015-09-01 17:10:52 PM
2.string-->date
Functions used: Str_to_date (Str,format) STR: Date in character format: Formatting style
Eg:str_to_date (' 1992-04-12 ', "%y-%m-%d") Output: 1992-04-12 (Date form)
"MySQL" DATE and String conversions (Date_format & Str_to_date)