MySQL - 将MM / DD / YY转换为Unix时间戳 [英] MySQL - Convert MM/DD/YY to Unix timestamp

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

问题描述



我正在从表中的列中读取这些值,我认为列本身被定义为一个字符串(不能帮助,我害怕)。

解决方案

使用 UNIX_TIMESTAMP ;

  SELECT UNIX_TIMESTAMP('2007-11-30 10:30:19'); 

更新:

  SELECT UNIX_TIMESTAMP(CAST(fieldName AS DATE)); 


Is there an easy (single query) way to do this?

I'm reading those values from a column in a table and I think that the column itself is defined as a string (can't be helped, i'm afraid).

解决方案

Use UNIX_TIMESTAMP;

SELECT UNIX_TIMESTAMP('2007-11-30 10:30:19');

Update:

SELECT UNIX_TIMESTAMP(CAST(fieldName AS DATE));

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

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