如何在不知道字符串格式的情况下将字符串转换为日期


How to convert string to date in without knowing the string format

我知道有一个MySQL函数可以将字符串转换为日期,但它需要字符串格式。

有没有办法在不知道格式的情况下做到这一点?

或者有没有办法使用 PHP 获取格式,以便我可以在 MySQL 中使用它?

Do you mean this ?
SELECT unix_timestamp('2013-11-14'), 
unix_timestamp('2013/11/14'), 
unix_timestamp('13/11/14'), 
unix_timestamp('13-11-14'),
from_unixtime(unix_timestamp('13-11-14'))
This will output 
1384358400 1384358400 1384358400 1384358400 "2013-11-14 00:00:00".

使用php的strtotime()函数,希望它可以帮助通过下面的链接。

http://php.net/manual/en/function.strtotime.php