Categories:
.NET (961)
C (387)
C++ (185)
CSS (84)
DBA (8)
General (31)
HTML (48)
Java (641)
JavaScript (220)
JSP (109)
JUnit (31)
MySQL (297)
Networking (10)
Oracle (562)
Perl (48)
Perl (9)
PHP (259)
PL/SQL (140)
RSS (51)
Software QA (28)
SQL Server (5)
Struts (20)
Unix (2)
Windows (3)
XHTML (199)
XML (59)
Other Resources:
How To Convert Character Strings to Dates
How To Convert Character Strings to Dates? - MySQL FAQs - Introduction to SQL Date and Time Handling
✍: FYIcenter.com
If you have a character string that represents a date, and you want to convert it into a date value, you can use the STR_TO_DATE(string, format) function. STR_TO_DATE() shares the same formatting codes with DATE_FORMAT() function. The tutorial exercise below shows you some good examples:
SELECT STR_TO_DATE('Friday, January 31, 1997', '%W, %M %e, %Y') FROM DUAL; 1997-01-31 SELECT STR_TO_DATE('Friday, January 31, 1997, 09:26:50 AM', '%W, %M %e, %Y, %h:%i:%s %p') FROM DUAL; 1997-01-31 09:26:50 SELECT STR_TO_DATE('31-Jan-1997 09:26:50.000123', '%d-%b-%Y %H:%i:%s.%f') FROM DUAL; 1997-01-31 09:26:50.000123
2007-05-11, 5415👍, 0💬
Popular Posts:
Which one of the following statements is TRUE in regard to overloading the ++ operator? 1 You cannot...
Can you tell me how to check whether a linked list is circular? Create two pointers, and set both to...
What is Shell scripting A shell script is a script written for the shell, or command line interprete...
What is the sequence of UML diagrams in project? First let me say some fact about this question, you...
How To Enter Binary Numbers in SQL Statements? - MySQL FAQs - Introduction to SQL Basics If you want...