MySQL STR_TO_DATE() Function
Clash Royale CLAN TAG#URR8PPP
<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]-->
MySQL STR_TO_DATE() Function
❮ MySQL Functions
Example
Return a date based on a string and a format:
SELECT
STR_TO_DATE("August 10 2017", "%M %d %Y");
Try it Yourself »
Definition and Usage
The STR_TO_DATE() function returns a date based on a string and a format.
Syntax
STR_TO_DATE(string, format)
Parameter Values
Parameter | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
string | Required. The string to be formatted to a date | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
format | Required. The format to use. Can be one or a combination of the following values:
|
Technical Details
Works in: | From MySQL 4.0 |
---|
More Examples
Example
Return a date based on a string and a format:
SELECT STR_TO_DATE("August,5,2017", "%M %e %Y");
Try it Yourself »
Example
Return a date based on a string and a format:
SELECT STR_TO_DATE("Monday, August 14, 2017", "%W %M %e %Y");
Try it Yourself »
Example
Return a date based on a string and a format:
SELECT STR_TO_DATE("2017,8,14 10,40,10", "%Y,%m,%d %h,%i,%s");
Try it Yourself »
❮ MySQL Functions