{"id":4964,"date":"2012-05-30T11:00:36","date_gmt":"2012-05-30T11:00:36","guid":{"rendered":"http:\/\/phpcodez.com\/?p=4964"},"modified":"2012-05-30T11:00:36","modified_gmt":"2012-05-30T11:00:36","slug":"sql_date_format","status":"publish","type":"post","link":"http:\/\/phpcodez.com\/sql_date_format\/","title":{"rendered":"SQL DATE_FORMAT()"},"content":{"rendered":"<p>SQL DATE_FORMAT() is used to display date\/time data in different formats.<\/p>\n<p><strong>Example<\/strong><\/p>\n<p>mysql&gt; SELECT DATE_FORMAT(NOW(),&#8217;%Y-%m-%D&#8217;);<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br \/>\n| DATE_FORMAT(NOW(),&#8217;%Y-%m-%D&#8217;) |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br \/>\n| 2007-05-30th \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0|<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+<br \/>\n1 row in set (0.00 sec)<\/p>\n<p><strong>Different formats<\/strong><\/p>\n<p>%a Abbreviated weekday name<br \/>\n%b Abbreviated month name<br \/>\n%c Month, numeric<br \/>\n%D Day of month with English suffix<br \/>\n%d Day of month, numeric (00-31)<br \/>\n%e Day of month, numeric (0-31)<br \/>\n%f Microseconds<br \/>\n%H Hour (00-23)<br \/>\n%h Hour (01-12)<br \/>\n%I Hour (01-12)<br \/>\n%i Minutes, numeric (00-59)<br \/>\n%j Day of year (001-366)<br \/>\n%k Hour (0-23)<br \/>\n%l Hour (1-12)<br \/>\n%M Month name<br \/>\n%m Month, numeric (00-12)<br \/>\n%p AM or PM<br \/>\n%r Time, 12-hour (hh:mm:ss AM or PM)<br \/>\n%S Seconds (00-59)<br \/>\n%s Seconds (00-59)<br \/>\n%T Time, 24-hour (hh:mm:ss)<br \/>\n%U Week (00-53) where Sunday is the first day of week<br \/>\n%u Week (00-53) where Monday is the first day of week<br \/>\n%V Week (01-53) where Sunday is the first day of week, used with %X<br \/>\n%v Week (01-53) where Monday is the first day of week, used with %x<br \/>\n%W Weekday name<br \/>\n%w Day of the week (0=Sunday, 6=Saturday)<br \/>\n%X Year of the week where Sunday is the first day of week, four digits, used with %V<br \/>\n%x Year of the week where Monday is the first day of week, four digits, used with %v<br \/>\n%Y Year, four digits<br \/>\n%y Year, two digits<br \/>\n<strong id=\"internal-source-marker_0.7798656104132533\"><br \/>\n<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>SQL DATE_FORMAT() is used to display date\/time data in different formats. Example mysql&gt; SELECT DATE_FORMAT(NOW(),&#8217;%Y-%m-%D&#8217;); +&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+ | DATE_FORMAT(NOW(),&#8217;%Y-%m-%D&#8217;) | +&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+ | 2007-05-30th \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0| +&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-+ 1 row in set (0.00 sec) Different formats %a Abbreviated weekday name %b Abbreviated month name %c Month, numeric %D Day of month with English suffix %d Day of month, numeric &hellip; <a href=\"http:\/\/phpcodez.com\/sql_date_format\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">SQL DATE_FORMAT()<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[213,332,370,392,457,461],"class_list":["post-4964","post","type-post","status-publish","format-standard","hentry","category-sql","tag-functions","tag-mysql","tag-php","tag-query","tag-sql","tag-statement"],"_links":{"self":[{"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/posts\/4964","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/comments?post=4964"}],"version-history":[{"count":0,"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/posts\/4964\/revisions"}],"wp:attachment":[{"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/media?parent=4964"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/categories?post=4964"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/phpcodez.com\/wp-json\/wp\/v2\/tags?post=4964"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}