European format time - Convert string to Datetime

2019-08-03 01:24发布

I want to be able to convert the following string format to Datetime.

'21-04-2010 11:06'

I've looked here but there doesn't seem to be solution: http://msdn.microsoft.com/en-us/library/ms187928.aspx

convert(datetime, '21-04-2010 11:06', ??)

Has anyone else come across this problem? Or is it listed somewhere else?

4条回答
We Are One
2楼-- · 2019-08-03 01:42

You can use STR_TO_DATE date in MySQL to parse your String

查看更多
闹够了就滚
3楼-- · 2019-08-03 01:45
select convert(datetime, '21-04-2010 11:06', 105)

Here the ref http://www.w3schools.com/sql/func_convert.asp Basically is dd-mm-yyyy format

查看更多
劫难
4楼-- · 2019-08-03 01:55

Try this:

select convert(datetime, '21-04-2010 11:06', 105) 
查看更多
smile是对你的礼貌
5楼-- · 2019-08-03 02:07

If it is sql server, use 105...like this:

select convert(datetime, '21-04-2010 11:06', 105)

it will work (sql server docs says that it is for 21-04-2010 ...but it will get your 11:06, too)

查看更多
登录 后发表回答