{"id":1945,"date":"2017-09-07T11:06:34","date_gmt":"2017-09-07T03:06:34","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=1945"},"modified":"2017-09-07T11:09:28","modified_gmt":"2017-09-07T03:09:28","slug":"mysql%e4%b8%ad%e7%9a%84date_format%e5%87%bd%e6%95%b0","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=1945","title":{"rendered":"MySQL\u4e2d\u7684date_format\u51fd\u6570"},"content":{"rendered":"<p>\n\tMySQL\u4e2d\u7684date_format\u51fd\u6570\u4f5c\u7528\u7c7b\u4f3c\u4e8eOracle\u4e2d\u7684TO_CHAR\u51fd\u6570\uff0c\u548cPostGreSQL\u4e2d\u7684TO_CHAR\u51fd\u6570\u529f\u80fd\u4e5f\u540c\u6837\u7c7b\u4f3c\uff0c\u53ea\u662f\u683c\u5f0f\u5316\u65f6\u95f4\u7684\u53c2\u6570\u4e0d\u4e00\u6837\u3002\u672c\u6587\u5c06\u6839\u636e\u4e2a\u4eba\u7684\u7ecf\u9a8c\uff0c\u6765\u8bf4\u4e0bdate_format\u7684\u7528\u6cd5\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"MySQL\" src=\"http:\/\/img.bbs.csdn.net\/upload\/201403\/28\/1396020665_418850.jpg\" \/>\n<\/p>\n<p>\n\tdate_format\u51fd\u6570\u7684\u4f5c\u7528\u662f\u628a\u65e5\u671f\u8f6c\u6362\u6210\u5b57\u7b26\u4e32\u3002\n<\/p>\n<p>\n\tdate_format(date,&#039;%Y-%m-%d&#039;)\u7c7b\u4f3c\u4e8eoracle\u4e2d\u7684to_char()\u3002\n<\/p>\n<p>\n\t\u76f8\u5173\u7684\u683c\u5f0f\u5316\u53c2\u6570\u89e3\u91ca\u5982\u4e0b\uff1a\n<\/p>\n<p>\n\t%Y\uff1a\u4ee3\u88684\u4f4d\u7684\u5e74\u4efd<br \/>\n\t%y\uff1a\u4ee3\u88682\u4e3a\u7684\u5e74\u4efd<br \/>\n\t&nbsp;<br \/>\n\t%m\uff1a\u4ee3\u8868\u6708, \u683c\u5f0f\u4e3a(01&hellip;&hellip;12) &nbsp;<br \/>\n\t%c\uff1a\u4ee3\u8868\u6708, \u683c\u5f0f\u4e3a(1&hellip;&hellip;12)<br \/>\n\t&nbsp;<br \/>\n\t%d\uff1a\u4ee3\u8868\u6708\u4efd\u4e2d\u7684\u5929\u6570,\u683c\u5f0f\u4e3a(00&hellip;&hellip;31) &nbsp;<br \/>\n\t%e\uff1a\u4ee3\u8868\u6708\u4efd\u4e2d\u7684\u5929\u6570, \u683c\u5f0f\u4e3a(0&hellip;&hellip;31)&nbsp;<br \/>\n\t&nbsp;<br \/>\n\t%H\uff1a\u4ee3\u8868\u5c0f\u65f6,\u683c\u5f0f\u4e3a(00&hellip;&hellip;23) &nbsp;<br \/>\n\t%k\uff1a\u4ee3\u8868 \u5c0f\u65f6,\u683c\u5f0f\u4e3a(0&hellip;&hellip;23) &nbsp;<br \/>\n\t%h\uff1a \u4ee3\u8868\u5c0f\u65f6,\u683c\u5f0f\u4e3a(01&hellip;&hellip;12) &nbsp;<br \/>\n\t%I\uff1a \u4ee3\u8868\u5c0f\u65f6,\u683c\u5f0f\u4e3a(01&hellip;&hellip;12) &nbsp;<br \/>\n\t%l \uff1a\u4ee3\u8868\u5c0f\u65f6,\u683c\u5f0f\u4e3a(1&hellip;&hellip;12)<br \/>\n\t&nbsp;&nbsp;<br \/>\n\t%i\uff1a \u4ee3\u8868\u5206\u949f, \u683c\u5f0f\u4e3a(00&hellip;&hellip;59)&nbsp;\n<\/p>\n<p>\n\t%r\uff1a\u4ee3\u8868 \u65f6\u95f4,\u683c\u5f0f\u4e3a12 \u5c0f\u65f6(hh:mm:ss [AP]M) &nbsp;<br \/>\n\t%T\uff1a\u4ee3\u8868 \u65f6\u95f4,\u683c\u5f0f\u4e3a24 \u5c0f\u65f6(hh:mm:ss)&nbsp;\n<\/p>\n<p>\n\t%S\uff1a\u4ee3\u8868 \u79d2,\u683c\u5f0f\u4e3a(00&hellip;&hellip;59) &nbsp;<br \/>\n\t%s\uff1a\u4ee3\u8868 \u79d2,\u683c\u5f0f\u4e3a(00&hellip;&hellip;59)&nbsp;\n<\/p>\n<p>\n\t\u770b\u4e0b\u9762\u7684\u4f8b\u5b50\uff1a\n<\/p>\n<pre class=\"brush:sql;\">\r\nSELECT DATE_FORMAT(20160909154540,&#039;%Y-%m-%d %H:%i:%s&#039;)<\/pre>\n<p>\n\t\u8f93\u51fa\u7ed3\u679c\u663e\u793a\uff1a\n<\/p>\n<pre class=\"brush:plain;\">\r\n2016-09-09 15:45:40\r\n<\/pre>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=1945\">MySQL\u4e2d\u7684date_format\u51fd\u6570<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>MySQL\u4e2d\u7684date_format\u51fd\u6570\u4f5c\u7528\u7c7b\u4f3c\u4e8eOracle\u4e2d\u7684TO_CHAR\u51fd\u6570\uff0c\u548cPostGreSQL\u4e2d [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[1484,83,467,1485],"class_list":["post-1945","post","type-post","status-publish","format-standard","hentry","category-sql","tag-date_format","tag-mysql","tag-oracle","tag-to_char"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1945","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1945"}],"version-history":[{"count":2,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1945\/revisions"}],"predecessor-version":[{"id":1947,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/1945\/revisions\/1947"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1945"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1945"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1945"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}