欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Mysql 日期時(shí)間 DATE_FORMAT(date,format)

 更新時(shí)間:2010年12月17日 11:14:27   作者:  
Mysql 日期時(shí)間 DATE_FORMAT(date,format) ,需要的朋友可以參考下。

本文轉(zhuǎn)自:http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html#function_date-format

  • DATE_FORMAT(date,format)

    Formats the date value according to the format string.

    The following specifiers may be used in the format string. As of MySQL 3.23, the “%” character is required before format specifier characters. In earlier versions of MySQL, “%” was optional.

    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

    The %v, %V, %x, and %X format specifiers are available as of MySQL 3.23.8. %f is available as of MySQL 4.1.1.

    Ranges for the month and day specifiers begin with zero due to the fact that MySQL permits the storing of incomplete dates such as '2014-00-00' (as of MySQL 3.23).

    As of MySQL 4.1.21, the language used for day and month names and abbreviations is controlled by the value of the lc_time_names system variable (Section 9.8, “MySQL Server Locale Support”).

    As of MySQL 4.1.23, 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 4.1.23, 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'
  • 相關(guān)文章

    • my.cnf(my.ini)重要參數(shù)優(yōu)化配置說明

      my.cnf(my.ini)重要參數(shù)優(yōu)化配置說明

      本文針對mysql不同存儲(chǔ)引擎,MyISAM與Innodb進(jìn)行了講解如何進(jìn)行my.cnf(my.ini)的參數(shù)優(yōu)化
      2018-03-03
    • mysql中影響數(shù)據(jù)庫性能的因素講解

      mysql中影響數(shù)據(jù)庫性能的因素講解

      在本篇文章中我們給大家講述了mysql中影響性能的因素以及相關(guān)知識(shí)點(diǎn)內(nèi)容,有興趣的朋友參考下。
      2018-09-09
    • MySQL 獲得當(dāng)前日期時(shí)間的函數(shù)小結(jié)

      MySQL 獲得當(dāng)前日期時(shí)間的函數(shù)小結(jié)

      MySQL 獲得當(dāng)前日期時(shí)間的函數(shù)小結(jié),需要的朋友可以參考下。
      2011-12-12
    • 在VB.NET應(yīng)用中使用MySQL的方法

      在VB.NET應(yīng)用中使用MySQL的方法

      這篇文章主要介紹了在VB.NET應(yīng)用中使用MySQL的方法,操作基于Visual Studio IDE進(jìn)行,需要的朋友可以參考下
      2015-06-06
    • 一文掌握MySQL表的創(chuàng)建和約束

      一文掌握MySQL表的創(chuàng)建和約束

      這篇文章主要和大家分享一下數(shù)據(jù)庫的創(chuàng)建和銷毀語法以及詳細(xì)講解MySQL表的創(chuàng)建代碼和約束的使用,文中的示例代碼講解詳細(xì),感興趣的可以了解一下
      2022-07-07
    • mysql where中如何判斷不為空的實(shí)現(xiàn)

      mysql where中如何判斷不為空的實(shí)現(xiàn)

      本文主要介紹了mysql where中如何判斷不為空的實(shí)現(xiàn),本文將針對這些空演示如何判斷是否為空,以及如何寫sql過濾,包括使用判空函數(shù),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
      2022-03-03
    • MySQL的主從備份方式(一主一從)

      MySQL的主從備份方式(一主一從)

      這篇文章主要介紹了MySQL的主從備份方式(一主一從),具有很好的參考價(jià)值,希望對大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
      2023-12-12
    • MySQL Version確認(rèn)問題(版本確認(rèn))

      MySQL Version確認(rèn)問題(版本確認(rèn))

      這篇文章主要介紹了MySQL Version確認(rèn)問題(版本確認(rèn)),具有很好的參考價(jià)值,希望對大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
      2022-12-12
    • MySQL對于各種鎖的概念理解

      MySQL對于各種鎖的概念理解

      今天小編就為大家分享一篇關(guān)于MySQL對于各種鎖的概念理解,小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧
      2018-12-12
    • MySQL恢復(fù)中的幾個(gè)問題解決方法

      MySQL恢復(fù)中的幾個(gè)問題解決方法

      這篇文章主要介紹了MySQL恢復(fù)中的幾個(gè)問題,需要的朋友可以參考下
      2016-01-01

    最新評論