将mysql时间戳转换为mktime [英] convert mysql timestamp to mktime

查看:127
本文介绍了将mysql时间戳转换为mktime的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下MySQL时间戳: 2009-06-23 16:21:48 如何将其转换为mktime()之类的格式?

I have the following MySQL timestamp: 2009-06-23 16:21:48 How can I convert it to a format like mktime()?

推荐答案

有一个MySQL函数

There is a MySQL function unix_timestamp. In your SQL query, instead of selecting the Datetime or Timestamp column directly, do this:

SELECT unix_timestamp(MyDatetimeColumn) FROM MyTable

或者,如果您已经有了字符串,则可以使用PHP函数 strtotime() .

Alternatively, if you have the string already, you could use the PHP function strtotime().

这篇关于将mysql时间戳转换为mktime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆