unix_timestamp()

mysql> select unix_timestamp();
+------------------+
| unix_timestamp() |
+------------------+
| 1464590043 |
+------------------+

unix_timestamp(date)

mysql> select unix_timestamp('2016-05-30');
+------------------------------+
| unix_timestamp('2016-05-30') |
+------------------------------+
| 1464537600 |
+------------------------------+ mysql> select unix_timestamp('2016-05-30 14:35:21');
+---------------------------------------+
| unix_timestamp('2016-05-30 14:35:21') |
+---------------------------------------+
| 1464590121 |
+---------------------------------------+

from_unixtime(unix_timestamp)

mysql> select from_unixtime(1464590043);
+---------------------------+
| from_unixtime(1464590043) |
+---------------------------+
| 2016-05-30 14:34:03 |
+---------------------------+

from_unixtime(unix_timestamp,format)

mysql> select from_unixtime(1464590043, '%Y %D %M %h:%i:%s %x');
+---------------------------------------------------+
| from_unixtime(1464590043, '%Y %D %M %h:%i:%s %x') |
+---------------------------------------------------+
| 2016 30th May 02:34:03 2016 |
+---------------------------------------------------+

MySQL(Unix时间戳、日期)转换函数的更多相关文章

  1. mysql中的日期转换函数(类似oracle中的to_date)

    最近使用mysql开发一个项目,发现没有像之前在用oracle数据中那样有to_date方法.mysql中实现日期格式化的方法为date_to_str('日期字符串','日期格式'),而且mysql中 ...

  2. Mysql日期转换函数、时间转换函数

    Mysql日期转换函数.时间转换函数 一.MySQL 获得当前日期时间 函数 1,获得当前日期+时间(date + time)函数:now(): select now(); 结果: :: 2,获得当前 ...

  3. MYSQL中的日期转换

    MYSQL中的日期转换 网址: http://www.eygle.com/digest/2006/09/mysql_date_convert.html 对于每个类型拥有的值范围以及并且指定日期何时间值 ...

  4. hive中的日期转换函数

    1.unix时间戳转时间函数   语法: from_unixtime(bigintunixtime[, string format]) 返回值: string   说明: 转化UNIX时间戳(从197 ...

  5. mysql UNIX时间戳与日期的相互转换

    UNIX时间戳转换为日期用函数: FROM_UNIXTIME() select FROM_UNIXTIME(1156219870); 日期转换为UNIX时间戳用函数: UNIX_TIMESTAMP() ...

  6. mysql UNIX时间戳与日期的相互转换 查询表信息

    UNIX时间戳转换为日期用函数FROM_UNIXTIME() select FROM_UNIXTIME(1156219870); 日期转换为UNIX时间戳用函数UNIX_TIMESTAMP() Sel ...

  7. mysql 将时间戳直接转换成日期时间

    date为需要处理的参数(该参数是Unix 时间戳),可以是字段名,也可以直接是Unix 时间戳字符串 后面的 '%Y%m%d' 主要是将返回值格式化 例如: mysql>SELECT FROM ...

  8. unix时间戳的转换

    UNIX时间戳转换为日期用函数: FROM_UNIXTIME() select FROM_UNIXTIME(1156219870); 日期转换为UNIX时间戳用函数: UNIX_TIMESTAMP() ...

  9. MySQL和时间戳有关的函数

    1. MySQL 获得当前时间戳函数:current_timestamp, current_timestamp()mysql> select current_timestamp, current ...

  10. hive日期转换函数2

    转自大神 http://www.oratea.net/?p=944 无论做什么数据,都离不开日期函数的使用. 这里转载一下Hive的日期函数的使用,写的相当完整. 日期函数UNIX时间戳转日期函数: ...

随机推荐

  1. RT-Thread 线程调度

    /* 变量分配4字节对齐 */ ALIGN(RT_ALIGN_SIZE) /* 静态线程的 线程堆栈*/ ]; ]; /* 静态线程的 线程控制块 */ static struct rt_thread ...

  2. nginx调优

    Nginx is an open-source Web Server. It is a high-performance HTTP server that uses very low server r ...

  3. coursera-miniproject Pang任务总结

    Mini_project开发过程 1.通过添加代码画出一个在乒乓球台移动的球.我们提醒你给乒乓台添加位置信息给draw handler像在”Motion"那节课第二部分介绍的那样 2.添加代 ...

  4. 【转】C# 解析 json

    C# 解析 json JSON(全称为JavaScript Object Notation) 是一种轻量级的数据交换格式.它是基于JavaScript语法标准的一个子集. JSON采用完全独立于语言的 ...

  5. Summary of java stream classes

    Java’s stream classes are good for streaming sequences of bytes, but they’re not good for streaming ...

  6. addevent

    function addEvent(a, b, c, d) { a.addEventListener ? a.addEventListener(b, c, d) : a.attachEvent(&qu ...

  7. 使用微信JS-SDK 实现 自定义 分享 功能

    微信PC端点击页面,转发给朋友.

  8. cvWaitKey 如果 cvNamedWindow就不会起作用

    Have you called cvNamedWindow yet? It will not work without cvNamedWindow. http://stackoverflow.com/ ...

  9. BLE 4.0 与 4.1的区别

    蓝牙技术让我们在连接各种设备的时候不再被繁多的数据线所束缚,比如音响.电脑,甚至是汽车.目前最新的蓝牙版本是4.0,相比3.0它进一步降低了功耗,并且也提高了传输效率.近日,蓝牙技术联盟(Blueto ...

  10. 桌面应用程序ClickOne打包部署

    http://www.cnblogs.com/weixing/p/3358740.html