The “Date Format” function is used but not limited to the following situations.
- If the current or default date format needs to be changed to meet the legal and cultural criteria for the date and time of recognition of the region.
- If an output demands a formatted date.
Syntax: date_format(date/timestamp/string ts, string fmt)
Examples:
SELECT date_format(‘2021-02-06’,”dd/MM/yyyy”);
Returns 06/02/2021
SELECT date_format(current_date, “dd-MM-yy hh:MM:ss.sss”);
Returns 06-02-21 12:02:00.000
Hope you find this article helpful.
Please click on follow button to updates on latest posts.
2 comments