如何在Mysql中将人的日期转换为unix时间戳? [英] How to convert human date to unix timestamp in Mysql?
本文介绍了如何在Mysql中将人的日期转换为unix时间戳?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
现在我必须复制该字段加上同一个表的一些其他字段到另一个表,但日期需要在unix时间戳。
mysql中是否有任何函数将人的日期转换为查询本身的unix时间戳?
解决方案
mysql>选择unix_timestamp('2008-01-08 19:23:32');
+ --------------------------------------- +
| unix_timestamp('2008-01-08 19:23:32')|
+ --------------------------------------- +
| 1199849012 |
+ --------------------------------------- +
1一行(0.04秒)
在这里找到: http://www.epochconverter.com/
I have a table with a date field, having human date in it like: '2008-01-08 19:23:32' Now i have to copy this field plus some other fields of the same table to another table, but date needs to be in unix timestamp.
Is there any function in mysql which converts human date to unix timestamp inside query itself?
解决方案
mysql> select unix_timestamp('2008-01-08 19:23:32');
+---------------------------------------+
| unix_timestamp('2008-01-08 19:23:32') |
+---------------------------------------+
| 1199849012 |
+---------------------------------------+
1 row in set (0.04 sec)
found here: http://www.epochconverter.com/
这篇关于如何在Mysql中将人的日期转换为unix时间戳?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文