Converting String date to database date in MySQL and Microsoft SQL server

Submitted by Jochus on Fri, 22/03/2013 - 18:53 | Posted in: Database


SELECT STR_TO_DATE('20/03/2013', '%d/%m/%Y')
FROM dual;

Microsoft SQL server

SELECT CONVERT(datetime, '20/03/2013', 103);

List of date & time style codes:

Add new comment

The content of this field is kept private and will not be shown publicly.


  • Lines and paragraphs break automatically.
  • You can caption images (data-caption="Text"), but also videos, blockquotes, and so on.
  • Web page addresses and email addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <cpp>, <css>, <html5>, <java>, <javascript>, <php>, <sql>, <xml>. The supported tag styles are: <foo>, [foo].
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.