天天看点

mysql中int时间和datetime时间的互相转换

MySQL

1、int时间转换为datetime时间

1

<code>FROM_UNIXTIME(reg_time)</code>

<code>select</code> <code>reg_time, FROM_UNIXTIME(reg_time) </code><code>from</code> <code>crm_user;</code>

2、datetime时间转换为int时间

2

<code>unix_timestamp(reg_time)</code>

<code>select reg_time,unix_timestamp(reg_time) from crm_user;</code>

<code></code><code></code>

<code></code><code>本文转自 virusswb 51CTO博客,原文链接:http://blog.51cto.com/virusswb/1527329,如需转载请自行联系原作者</code>

<code></code>

继续阅读