开发者

Convert dd/mm/yyyy string to Unix timestamp in MySQL

In my table I have a varchar column called date containing string representations of dates in dd/mm/yyyy format. How can I convert these to Un开发者_如何学编程ix times in a SELECT query?


select unix_timestamp(str_to_date('30/05/2011','%d/%m/%Y'));

or:

select unix_timestamp(str_to_date(myfield,'%d/%m/%Y')) from mytable;


I think UNIX_TIMESTAMP should do the trick. Can you specify your select query here?

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_unix-timestamp


just use unix_timestamp function

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜