`
baiguomeng
  • 浏览: 954916 次
文章分类
社区版块
存档分类
最新评论

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

分享到:
评论

相关推荐

    FROM_UNIXTIME 格式化MYSQL时间戳函数

    函数:FROM_UNIXTIME作用:将MYSQL中以INT(11)存储的时间以”YYYY-MM-DD”格式来显示。语法:FROM_UNIXTIME(unix_timestamp,format) 返回表示 Unix 时间标记的一个字符串,根据format字符串格式化。format可以包含与...

    MySQL 5.1官方简体中文参考手册

    MySQL 5.1 Reference Manual 1.7.1. MySQL邮件列表 1.7.2. IRC(在线聊天系统)上的MySQL社区支持 1.7.3. MySQL论坛上的MySQL社区支持 1.8. MySQL标准的兼容性 1.8.1. MySQL遵从的标准是什么 1.8.2. 选择SQL模式 ...

    MySql 5.1 参考手册.chm

    5.1. MySQL服务器和服务器启动脚本 5.1.1. 服务器端脚本和实用工具概述 5.1.2. mysqld-max扩展MySQL服务器 5.1.3. mysqld_safe:MySQL服务器启动脚本 5.1.4. mysql.server:MySQL服务器启动脚本 5.1.5. mysqld_multi...

    oracle中日期类型与unix 时间戳的转换

    oracle中日期类型与unix 时间戳的转换, Unix时间戳记是从'1970-01-01 00:00:00'GMT开始的秒数,表现为整数型。 Oracle中的时间是Date型,以下函数提供了两种时间转换的Oracle函数 --unix时间戳与date时间互转 ...

    MySQL 5.1参考手册

    MySQL 5.1参考手册.chm 前言 1. 一般信息 1.1. 关于本手册 1.2. 本手册采用的惯例 1.3. MySQL AB概述 1.4. MySQL数据库管理系统概述 1.4.1. MySQL的历史 1.4.2. MySQL的的主要特性 1.4.3. MySQL稳定性 1.4.4. MySQL...

    MySQL 5.1参考手册 (中文版)

    12.5. 日期和时间函数 12.6. MySQL使用什么日历? 12.7. 全文搜索功能 12.7.1. 布尔全文搜索 12.7.2. 全文搜索带查询扩展 12.7.3. 全文停止字 12.7.4. 全文限定条件 12.7.5. 微调MySQL全文搜索 12.8. Cast函数和操作...

    thinkphp5.1框架实现格式化mysql时间戳为日期的方式小结

    本文实例讲述了thinkphp5.1框架实现格式化mysql时间戳为日期的方式。分享给大家供大家参考,具体如下: 方式一 使用mysql函数FROM_UNIXTIME(unix_timestamp,format)直接转换 select FROM_UNIXTIME(o.create_time,'...

    MySQL 5.1参考手册中文版

    12.5. 日期和时间函数 12.6. MySQL使用什么日历? 12.7. 全文搜索功能 12.7.1. 布尔全文搜索 12.7.2. 全文搜索带查询扩展 12.7.3. 全文停止字 12.7.4. 全文限定条件 12.7.5. 微调MySQL全文搜索 12.8. Cast...

    mysql 日期函数.txt

    1. 2.DAYOFWEEK(date) 3.WEEKDAY(date) 4.DAYOFMONTH(date) 5.DAYOFYEAR(date) 6.MONTH(date) 7.DAYNAME(date) ...FROM_UNIXTIME(unix_timestamp,format) 27.SEC_TO_TIME(seconds) 28.TIME_TO_SEC(time)

    python正常时间和unix时间戳相互转换的方法

    本文实例讲述了python正常时间和unix时间戳相互转换的方法。分享给大家供大家参考。具体分析如下: 这段代码可以用来转换常规时间格式为unix时间戳,也可以将unix时间戳转换回来, 例如:1332888820 格式转换成 ...

    MySQL5.1参考手册官方简体中文版

    MySQL 5.1参考手册 这是MySQL参考手册的翻译版本,关于MySQL参考手册,请访问dev.mysql.com。 原始参考手册为英文版,与英文版参考手册相比,本翻译版可能不是最新的。 This translation was done by MySQL ...

    MySQL UNIX时间戳与日期的相互转换

    在MySQL中UNIX时间戳与日期的相互转换,举例说明 FROM_UNIXTIME 和 UNIX_TIMESTAMP 函数的使用。

    PHP函数参考手册大全

    Date/Time 日期/时间函数 XXIII. DB++ Functions XXIV. dBase Functions XXV. DBM Functions [deprecated] XXVI. dbx Functions XXVII. Direct IO Functions XXVIII. Directory 目录函数 XXIX. DOM Functions XXX....

    PHP官方手册中文版

    Date/Time 日期/时间函数 XXIV. DB++ Functions XXV. Database (dbm-style) Abstraction Layer Functions XXVI. dBase Functions XXVII. DBM Functions [deprecated] XXVIII. dbx Functions XXIX. Direct IO...

    Unix时间戳转北京时间 UTC时间转北京时间 C代码实现

    Unix时间戳转北京时间,用到“time.h”头文件,是C语言的标准库,使用localtime函数进行转换;北京时间转Unix时间戳,使用mktime函数进行转换;UTC时间转化成北京时间,思路:把UTC时间转换成时间戳,然后时间戳数值...

    PHP手册2007整合中文版

    Date/Time 日期/时间函数 XXIV. DB++ Functions XXV. Database (dbm-style) Abstraction Layer Functions XXVI. dBase Functions XXVII. DBM Functions [deprecated] XXVIII. dbx Functions XXIX. Direct IO ...

    unix时间戳转格式.rar

    unix时间戳转格式.rar unix时间戳转格式.rar unix时间戳转格式.rar unix时间戳转格式.rar unix时间戳转格式.rar unix时间戳转格式.rar

Global site tag (gtag.js) - Google Analytics