logo
Blog single photo

how to manage MySQL STR_TO_DATE function


                        

STR_TO_DATE function converts a string to DATETIME, DATE or TIME format 

Syntax : STR_TO_DATE(string, format)

Example : SELECT * FROM `car_alotment` WHERE STR_TO_DATE(`start_date`,'%Y-%m-%d')<=1579890600

Follow this list which has given below

%Y 4-digit year

%y 2-digit year 

%b Abbreviated month (Jan - Dec)

%M Month name (January - December)

%m Month (0 - 12) Zero month supported by MySQL

%a Abbreviated day (Sun - Sat)

%d Day (0 - 31) Zero day supported by MySQL

%H Hour (0 - 23)

%h Hour (01 - 12)

%i Minutes (0 - 59)

%s Seconds (0 - 59)

See Full List Mysql Datetime Format

Top