mysql字符串转时间函数显示到毫秒,如何在MySQL中将秒(或毫秒)转换为时间戳(或只是一个看起来像日期的字符串)...

I'm looking at this documentation

http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_maketime

And I KNOW I must be missing it, but I just don't see a function here that I can pass seconds (or milliseconds) to, and get back either a Timestamp, or just a string representing the date.

Please help.

解决方案

If you are working with seconds since 1970 (i.e. Unix timestamps then FROM_UNIXTIME()) could well be what you want.

FROM_UNIXTIME Returns a representation of the unix_timestamp argument as a value in

'YYYY-MM-DD HH:MM:SS' or YYYYMMDDHHMMSS.uuuuuu format, depending on whether the function is

used in a string or numeric context.

The value is expressed in the current time zone. unix_timestamp is an internal timestamp value such as is produced by the UNIX_TIMESTAMP() function.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值