如何在 mysql 动态查询中转换日期格式
How to convert date format in mysql dynamic query
我想插入 mm/dd/yyyy 到 mysql 如何转换成默认格式,我需要动态查询
$sql="INSERT INTO user_db (EMAIL,PWD,SQUE,SANS,FNM,LNM,DOB,GENDER,ROLE) values
('".$email."','".$pass."','".$sq."','".$ans."','".$fname."','".$lname."','".???."','".$gen."','".$role."')";
用户输入mm/dd/yyyy格式转换为默认格式
无法更改 MySQL 接受的日期文字。它们列在文档中 here, and are fixed. Instead, you have to change the format of the date you input. Answers to this 问题将告诉您如何。
- 数据库中的日期格式始终为 yyyy-mm-dd 格式
- 但是在抓取时,您可以按照下面指定的 dd-mm-yyyy 格式抓取。
- SELECT DATE_FORMAT(datecolumn,'%d-%m-%Y') AS dateColumn FROM table
我想插入 mm/dd/yyyy 到 mysql 如何转换成默认格式,我需要动态查询
$sql="INSERT INTO user_db (EMAIL,PWD,SQUE,SANS,FNM,LNM,DOB,GENDER,ROLE) values
('".$email."','".$pass."','".$sq."','".$ans."','".$fname."','".$lname."','".???."','".$gen."','".$role."')";
用户输入mm/dd/yyyy格式转换为默认格式
无法更改 MySQL 接受的日期文字。它们列在文档中 here, and are fixed. Instead, you have to change the format of the date you input. Answers to this 问题将告诉您如何。
- 数据库中的日期格式始终为 yyyy-mm-dd 格式
- 但是在抓取时,您可以按照下面指定的 dd-mm-yyyy 格式抓取。
- SELECT DATE_FORMAT(datecolumn,'%d-%m-%Y') AS dateColumn FROM table