网络服务器软件开发/中间件开发,关注ACE/ICE/boost

C++博客 首页 新随笔 联系 聚合 管理
  152 Posts :: 3 Stories :: 172 Comments :: 0 Trackbacks
   手册上的说明:
   

   UNIX_TIMESTAMP(), UNIX_TIMESTAMP(date)

If called with no argument, returns a Unix timestamp (seconds since '1970-01-01 00:00:00' UTC) as an unsigned integer. If UNIX_TIMESTAMP() is called with a date argument, it returns the value of the argument as seconds since '1970-01-01 00:00:00' UTC. date may be a DATE string, a DATETIME string, a TIMESTAMP, or a number in the format YYMMDD or YYYYMMDD. The server interprets date as a value in the current time zone and converts it to an internal value in UTC. Clients can set their time zone as described in Section 5.11.8, “MySQL Server Time Zone Support”.


      这里的UNIX_TIMESTAMP()的返回值和C函数time(NULL)的返回值含义一样,
  mysql> select UNIX_TIMESTAMP();
+------------------+
| UNIX_TIMESTAMP() |
+------------------+
|       1292815556 |
+------------------+
1 row in set

mysql> select FROM_UNIXTIME(1292815556);
+---------------------------+
| FROM_UNIXTIME(1292815556) |
+---------------------------+
| 2010-12-20 11:25:56       |
+---------------------------+
1 row in set

posted on 2010-12-20 12:01 true 阅读(470) 评论(0)  编辑 收藏 引用 所属分类: mysql

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理