Search results
22 kwi 2011 · You must add Convert Zero Datetime=True to your connection string, for example: server=localhost;User Id=root;password=mautauaja;Persist Security Info=True;database=test;Convert Zero Datetime=True
20 maj 2015 · Solution 1. You have to use Date.TryParse method [^], which provides a way to convert date using specific culture [^] (localization). or. You can convert date while getting data from MySQL server by using Date and Time functions [^].
29 mar 2018 · STR_TO_DATE() returns a DATETIME value if the format string contains both date and time parts, or a DATE or TIME value if the string contains only date or time parts. This query, containing a date as well as a time part, does work:
29 sie 2017 · Definition and Usage. The CONVERT () function converts a value into the specified datatype or character set. Tip: Also look at the CAST () function. Syntax. CONVERT (value, type) OR: CONVERT (value USING charset) Parameter Values. Technical Details. More Examples. Example. Convert a value to a CHAR datatype: SELECT CONVERT(150, CHAR);
26 sty 2024 · The most straightforward function for converting a string to a date or date/time in MySQL is the STR_TO_DATE() function. It takes a string and a format specifier and returns a formatted date: SELECT STR_TO_DATE('2021-04-30', '%Y-%m-%d') AS formatted_date; Output: 2021-04-30.
17 wrz 2010 · STR_TO_DATE function converts a string in the specified format to DATETIME, DATE or TIME value. Syntax STR_TO_DATE(string, format) Quick Example SELECT STR_TO_DATE('17-09-2010','%d-%m-%Y'); Error Returns NULL if the format is not matched, or datetime value is not valid Version: MySQL 5.6.
How to use the MySQL STR_TO_DATE() function to convert a string into a date and/or time value with various practical examples.