DATE_FORMAT(date,format)

Formats the date

value according to

the format string.

The following specifiers may be used in the

format string. The

“%”

character is required

before format specifier characters.

Specifier

Description

%a

Abbreviated weekday name

(Sun..Sat)

%b

Abbreviated month name (Jan..Dec)

%c

Month, numeric (0..12)

%D

Day of the month with English suffix (0th,

1st, 2nd,

3rd, …)

%d

Day of the month, numeric (00..31)

%e

Day of the month, numeric (0..31)

%f

Microseconds (000000..999999)

%H

Hour (00..23)

%h

Hour (01..12)

%I

Hour (01..12)

%i

Minutes, numeric (00..59)

%j

Day of year (001..366)

%k

Hour (0..23)

%l

Hour (1..12)

%M

Month name (January..December)

%m

Month, numeric (00..12)

%p

AM or PM

%r

Time, 12-hour (hh:mm:ss followed by

AM or PM)

%S

Seconds (00..59)

%s

Seconds (00..59)

%T

Time, 24-hour (hh:mm:ss)

%U

Week (00..53),

where Sunday is the

first day of the week

%u

Week (00..53),

where Monday is the

first day of the week

%V

Week (01..53),

where Sunday is the

first day of the week; used with %X

%v

Week (01..53),

where Monday is the

first day of the week; used with %x

%W

Weekday name (Sunday..Saturday)

%w

Day of the week

(0=Sunday..6=Saturday)

%X

Year for the week where Sunday is the first day of the week,

numeric,

four digits; used with %V

%x

Year for the week, where Monday is the first day of the week,

numeric,

four digits; used with %v

%Y

Year, numeric, four digits

%y

Year, numeric (two digits)

%%

A literal “%”

character

%x

x, for any

“x”

not listed

above

Ranges for the month and day specifiers begin with zero due to

the fact that MySQL allows the storing of incomplete dates

such as '2014-00-00'.

As of MySQL 5.1.12, the language used for day and month names

and abbreviations is controlled by the value of the

lc_time_names system variable

(Section 9.7, “MySQL Server

Locale Support”).

As of MySQL 5.1.15,

DATE_FORMAT() returns a string

with a character set and collation given by

character_set_connection and

collation_connection so that

it can return month and weekday names containing non-ASCII

characters. Before 5.1.15, the return value is a binary

string.

mysql> SELECT DATE_FORMAT('2009-10-04 22:23:00', '%W %M %Y');

-> 'Sunday October 2009'

mysql> SELECT DATE_FORMAT('2007-10-04 22:23:00', '%H:%i:%s');

-> '22:23:00'

mysql> SELECT DATE_FORMAT('1900-10-04 22:23:00',

-> '%D %y %a %d %m %b %j');

-> '4th 00 Thu 04 10 Oct 277'

mysql> SELECT DATE_FORMAT('1997-10-04 22:23:00',

-> '%H %k %I %r %T %S %w');

-> '22 22 10 10:23:00 PM 22:23:00 00 6'

mysql> SELECT DATE_FORMAT('1999-01-01', '%X %V');

-> '1998 52'

mysql> SELECT DATE_FORMAT('2006-06-00', '%d');

-> '00'

linux date fmt,date_format(date,frm) 详解相关推荐

  1. Linux系统常用命令及其使用详解大全

    Linux系统常用命令及其使用详解大全 整理了linux常用的命令,最长常用的也就几十个,cd,ls ,vi等等,有些容易忘记,经常拿出来看看. 其他的可以推荐一个网站,https://www.lin ...

  2. Linux的shutdown关机命令,Linux系统Shutdown命令定时关机详解

    转自:http://www.bootf.com/490.html Linux系统下的shutdown命令用于安全的关闭/重启计算机,它不仅可以方便的实现定时关机,还可以由用户决定关机时的相关参数.在执 ...

  3. Linux中/proc目录下文件详解

    Linux中/proc目录下文件详解(一) 声明:可以自由转载本文,但请务必保留本文的完整性. 作者:张子坚 email:zhangzijian@163.com 说明:本文所涉及示例均在fedora ...

  4. linux tf命令,Linux系统命令介绍之vmstat命令详解

    今天小编要跟大家介绍的vmstat命令详解.熟悉Linux系统和使用Linux系统工作的小伙伴都知道Linux的命令有很多,而真正在工作中用到的命令应该不超过几十个,为了让大家更好的掌握这些命令,小编 ...

  5. linux mount命令参数及用法详解

    linux mount命令参数及用法详解 非原创,主要来自 http://www.360doc.com/content/13/0608/14/12600778_291501907.shtml. htt ...

  6. Linux下Nginx编译安装过程详解

    Linux下Nginx编译安装过程详解 一.Nginx介绍 二.Nginx源码下载 1.打开Nginx官网 2.下载官网的源码包 三.Nginx源码安装 1.解压源码包 2.安装开发包组及环境 3.编 ...

  7. Linux下的samba服务配置详解

    Linux下的samba服务配置详解 一.Samba介绍 二.Samba工具及特性 三.搭建环境介绍 四.Samba配置步骤 1.服务端操作 2.在客户端操作 五.测试用户的权限情况 一.Samba介 ...

  8. Linux中/proc目录下文件详解(二)

    Linux中/proc目录下文件详解(二) /proc/mdstat文件 这个文件包含了由md设备驱动程序控制的RAID设备信息. 示例: [root@localhost ~]# cat /proc/ ...

  9. linux 进程间通信 dbus-glib【实例】详解四(上) C库 dbus-glib 使用(附代码)(编写接口描述文件.xml,dbus-binding-tool工具生成绑定文件)(列集散集函数)

    linux 进程间通信 dbus-glib[实例]详解一(附代码)(d-feet工具使用) linux 进程间通信 dbus-glib[实例]详解二(上) 消息和消息总线(附代码) linux 进程间 ...

最新文章

  1. 线段树 ---- CF1004F Sonya and Bitwise OR(线段树上分治合并区间信息 + or 前缀和的log性质)
  2. Gridview数据显示实现按日期排序分割线
  3. linux 图形界面 x x11 gnome xorg kde 之间的关系
  4. 在centos7离线安装mysql_CentOS7离线安装MySQL
  5. java.io.IOException: No space left on device
  6. 无废话ADO.NET 第二章 关于连接
  7. MATLAB软件禁用利好,Matlab被禁用?一款国产软件站了出来说:我就是中国的Matlab...
  8. python语言程序设计期末试卷_Python语言程序设计17182试题题目及答案,课程2020最新期末考试题库,章节测验答案...
  9. android--关于apk加密那点事的思考
  10. web前端期末大作业 html+css+javascript网页设计实例——端午节日(25页) 图片滚动
  11. c语言错误 应输入声明,C++错误:应输入声明
  12. 移动终端浏览器初始设置apple-mobile-web-app-capable(转)
  13. Linux eBPF内核源码sample/bpf全网最细解析(一)
  14. 宝宝纸尿裤怎么选?我联合2000位宝妈,对20款纸尿裤做了次测评
  15. 1378:最短路径(shopth)——Floyd
  16. session有效时间问题
  17. 手机短信验证码开发流程
  18. 脚本语言、编程语言、中间件
  19. python小波变换去噪
  20. webpack之配置es6转换成es5

热门文章

  1. word光标一直闪动_6个一分钟就能学会的Word实用小技巧,你会几个?【Word教程】...
  2. gentoo linux 分区_小白安装Gentoo Linux操作系统——磁盘分区
  3. socket模拟http的登陆_python模拟登陆知乎(最新版)
  4. 正整数 n 所有可能的和式的组合
  5. 机器学习的几种方法(knn,逻辑回归,SVM,决策树,随机森林,极限随机树,集成学习,Adaboost,GBDT)
  6. matlab控制realsense,RealSense开发学习--1.初识RealSense
  7. 3 运行时间太长_10大污水处理预处理系统动态图及运行管理、故障处理
  8. 爬虫 404 try_Python爬虫MOOC笔记
  9. CoreData并发操作模式简介
  10. java获取当前电脑的ip_使用Java获取当前计算机的IP地址