MySQL - 翻译 - 5.1Reference Manual参考手册 - 11.6. Date and Time Functions日期和时间函数 - FROM_UNIXTIME将UNIX时间戳格...

MySQL - 翻译 - 5.1Reference Manual参考手册 - 11.6.Date and Time Functions日期和时间函数 - FROM_UNIXTIME将UNIX时间戳格式化为日期

FROM_UNIXTIME(unix_timestamp), FROM_UNIXTIME(unix_timestamp,format)

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.

返回'YYYY-MM-DD HH:MM:SS'或YYYYMMDDHHMMSS.uuuuuu 格式值的unix_timestamp参数表示,具体格式取决于该函数是否用在字符串中或是数字语境中。该值以当前时间区域中表示,unix_timestamp 是一个类似于使用UNIX_TIMESTAMP()函数生成的内部时间戳值。

If format is given, the result is formatted according to the format string, which is used the same way as listed in the entry for the DATE_FORMAT() function.

format 已经给出,则结果的格式是根据format 字符串而定。 format 可以包含同DATE_FORMAT() 函数输入项列表中相同的说明符。

mysql> SELECT FROM_UNIXTIME(1196440219);
-> '2007-11-30 10:30:19'
mysql> SELECT FROM_UNIXTIME(1196440219) + 0;
-> 20071130103019.000000
mysql> SELECT FROM_UNIXTIME(UNIX_TIMESTAMP(),
-> '%Y %D %M %h:%i:%s %x');
-> '2007 30th November 10:30:59 2007'

Note: If you use UNIX_TIMESTAMP() and FROM_UNIXTIME() to convert between TIMESTAMP values and Unix timestamp values, the conversion is lossy because the mapping is not one-to-one in both directions. For details, see the description of the UNIX_TIMESTAMP() function.

注意:如果使用UNIX_TIMESTAMP()和FROM_UNIXTIME()在TIMESTAMP值和Unix时间戳值之间转换,由于双向不是一对一映射,因此转换是有损的。细节请参考UNIX_TIMESTAMP()函数。

[MySQL - 5.1Reference Manual参考手册 - 11 Functions and Operators函数和操作符 - 11.6.Date and Time Functions日期和时间函数 - FROM_UNIXTIME将UNIX时间戳格式化为日期 - 文档]

http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_from-unixtime
http://dev.mysql.com/doc/refman/5.1/zh/functions.html#date-and-time-functions

[MySQL - 官方网站]

http://www.mysql.com/

[MySQL - 关键词]

mysql

[MySQL - 相关论坛]

[MySQL - 下载]

http://dev.mysql.com/downloads/

[MySQL - 5.1 Reference Manual参考手册]

MySQL - 5. 数据库管理 - 5.3. mysqld:MySQL服务器 - 5.3.3. 服务器系统变量 - max_allowed_packet, http://dev.mysql.com/doc/refman/5.1/zh/database-administration.html#server-system-variables

9. 语言结构 - 9.2. 数据库、表、索引、列和别名 - 9.2.2. 识别符大小写敏感性, http://dev.mysql.com/doc/refman/5.1/zh/language-structure.html#name-case-sensitivity

11.6.Date and Time Functions日期和时间函数 - FROM_UNIXTIME将UNIX时间戳格式化为日期, http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_from-unixtime

12 SQL Statement Syntax - SQL语句语法 - 12.8 MySQL Compound-Statement Syntax - MySQL复合语句语法 - 12.8.6 Flow Control Constructs流程控制结构 -12.8.6.2. CASE Statement - CASE语句, http://dev.mysql.com/doc/refman/5.1/en/case-statement.html
13. SQL语句语法 - 13.1.数据定义语句 - 13.1.5.CREATE TABLE语法, http://dev.mysql.com/doc/refman/5.1/zh/sql-syntax.html#create-table

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值