{"id":301,"date":"2018-05-23T08:41:37","date_gmt":"2018-05-23T08:41:37","guid":{"rendered":"https:\/\/webnus.site\/dox\/?p=301"},"modified":"2023-10-31T11:51:57","modified_gmt":"2023-10-31T11:51:57","slug":"php-date-formats","status":"publish","type":"knowledgebase","link":"https:\/\/webnus.net\/dox\/modern-events-calendar\/php-date-formats\/","title":{"rendered":"PHP Date Formats"},"content":{"rendered":"\n<p>Here\u2019s a list of the characters of all date formats in <a href=\"http:\/\/webnus.net\" target=\"_blank\" rel=\"noreferrer noopener\">MEC<\/a>. From here, you can choose to display the date format you want: (Click\u00a0<a href=\"https:\/\/wordpress.org\/support\/article\/formatting-date-and-time\/\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>\u00a0for more information on WordPress date formats.) <\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"MEC_PHP_Date_Formats\"><\/span>MEC PHP Date Formats<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"785\" height=\"91\" src=\"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-content\/uploads\/2023\/10\/dateformat.png\" alt=\"PHP Date Formats\" class=\"wp-image-9852\" title=\"\" srcset=\"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-content\/uploads\/2023\/10\/dateformat.png 785w, https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-content\/uploads\/2023\/10\/dateformat-300x35.png 300w, https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-content\/uploads\/2023\/10\/dateformat-768x89.png 768w\" sizes=\"auto, (max-width: 785px) 100vw, 785px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"PHP_Date_Formats_Table\"><\/span>PHP Date Formats Table<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table class=\"has-fixed-layout\"><thead><tr><th><code>format<\/code><br>character<\/th><th><code>Description<\/code><br>Comment<\/th><th><code>Example<\/code><br>returned values<\/th><\/tr><\/thead><tbody><tr><td><em>Day<\/em><\/td><td>&#8212;<\/td><td>&#8212;<\/td><\/tr><tr><td><em>d<\/em><\/td><td>Day of the month, 2 digits with leading zeros<\/td><td><em>01<\/em>&nbsp;to&nbsp;<em>31<\/em><\/td><\/tr><tr><td><em>D<\/em><\/td><td>A textual representation of a day, three letters<\/td><td><em>Mon<\/em>&nbsp;through&nbsp;<em>Sun<\/em><\/td><\/tr><tr><td><em>j<\/em><\/td><td>Day of the month without leading zeros<\/td><td><em>1<\/em>&nbsp;to&nbsp;<em>31<\/em><\/td><\/tr><tr><td><em>l<\/em>&nbsp;(lowercase &#8216;L&#8217;)<\/td><td>A full textual representation of the day of the week<\/td><td><em>Sunday<\/em>&nbsp;through&nbsp;<em>Saturday<\/em><\/td><\/tr><tr><td><em>N<\/em><\/td><td>ISO-8601 numeric representation of the day of the week (added in PHP 5.1.0)<\/td><td><em>1<\/em>&nbsp;(for Monday) through&nbsp;<em>7<\/em>&nbsp;(for Sunday)<\/td><\/tr><tr><td><em>S<\/em><\/td><td>English ordinal suffix for the day of the month, 2 characters<\/td><td><em>st<\/em>,&nbsp;<em>nd<\/em>,&nbsp;<em>rd<\/em>&nbsp;or&nbsp;<em>th<\/em>. Works well with&nbsp;<em>j<\/em><\/td><\/tr><tr><td><em>w<\/em><\/td><td>Numeric representation of the day of the week<\/td><td><em>0<\/em>&nbsp;(for Sunday) through&nbsp;<em>6<\/em>&nbsp;(for Saturday)<\/td><\/tr><tr><td><em>z<\/em><\/td><td>The day of the year (starting from 0)<\/td><td><em>0<\/em>&nbsp;through&nbsp;<em>365<\/em><\/td><\/tr><tr><td><em>Week<\/em><\/td><td>&#8212;<\/td><td>&#8212;<\/td><\/tr><tr><td><em>W<\/em><\/td><td>ISO-8601 week number of year, weeks starting on Monday<\/td><td>Example:&nbsp;<em>42<\/em>&nbsp;(the 42nd week in the year)<\/td><\/tr><tr><td><em>Month<\/em><\/td><td>&#8212;<\/td><td>&#8212;<\/td><\/tr><tr><td><em>F<\/em><\/td><td>A full textual representation of a month, such as January or March<\/td><td><em>January<\/em>&nbsp;through&nbsp;<em>December<\/em><\/td><\/tr><tr><td><em>m<\/em><\/td><td>Numeric representation of a month, with leading zeros<\/td><td><em>01<\/em>&nbsp;through&nbsp;<em>12<\/em><\/td><\/tr><tr><td><em>M<\/em><\/td><td>A short textual representation of a month, three letters<\/td><td><em>Jan<\/em>&nbsp;through&nbsp;<em>Dec<\/em><\/td><\/tr><tr><td><em>n<\/em><\/td><td>Numeric representation of a month, without leading zeros<\/td><td><em>1<\/em>&nbsp;through&nbsp;<em>12<\/em><\/td><\/tr><tr><td><em>t<\/em><\/td><td>Number of days in the given month<\/td><td><em>28<\/em>&nbsp;through&nbsp;<em>31<\/em><\/td><\/tr><tr><td><em>Year<\/em><\/td><td>&#8212;<\/td><td>&#8212;<\/td><\/tr><tr><td><em>L<\/em><\/td><td>Whether it&#8217;s a leap year<\/td><td><em>1<\/em>&nbsp;if it is a leap year,&nbsp;<em>0<\/em>&nbsp;otherwise.<\/td><\/tr><tr><td><em>o<\/em><\/td><td>ISO-8601 week-numbering year. This has the same value as&nbsp;<em>Y<\/em>, except that if the ISO week number (&nbsp;<em>W<\/em>) belongs to the previous or next year, that year is used instead. (added in PHP 5.1.0)<\/td><td>Examples:&nbsp;<em>1999<\/em>&nbsp;or&nbsp;<em>2003<\/em><\/td><\/tr><tr><td><em>Y<\/em><\/td><td>A full numeric representation of a year, 4 digits<\/td><td>Examples:&nbsp;<em>1999<\/em>&nbsp;or&nbsp;<em>2003<\/em><\/td><\/tr><tr><td><em>y<\/em><\/td><td>A two digit representation of a year<\/td><td>Examples:&nbsp;<em>99<\/em>&nbsp;or&nbsp;<em>03<\/em><\/td><\/tr><tr><td><em>Time<\/em><\/td><td>&#8212;<\/td><td>&#8212;<\/td><\/tr><tr><td><em>a<\/em><\/td><td>Lowercase Ante meridiem and Post meridiem<\/td><td><em>am<\/em>&nbsp;or&nbsp;<em>pm<\/em><\/td><\/tr><tr><td><em>A<\/em><\/td><td>Uppercase Ante meridiem and Post meridiem<\/td><td><em>AM<\/em>&nbsp;or&nbsp;<em>PM<\/em><\/td><\/tr><tr><td><em>B<\/em><\/td><td>Swatch Internet time<\/td><td><em>000<\/em>&nbsp;through&nbsp;<em>999<\/em><\/td><\/tr><tr><td><em>g<\/em><\/td><td>12-hour format of an hour without leading zeros<\/td><td><em>1<\/em>&nbsp;through&nbsp;<em>12<\/em><\/td><\/tr><tr><td><em>G<\/em><\/td><td>24-hour format of an hour without leading zeros<\/td><td><em>0<\/em>&nbsp;through&nbsp;<em>23<\/em><\/td><\/tr><tr><td><em>h<\/em><\/td><td>12-hour format of an hour with leading zeros<\/td><td><em>01<\/em>&nbsp;through&nbsp;<em>12<\/em><\/td><\/tr><tr><td><em>H<\/em><\/td><td>24-hour format of an hour with leading zeros<\/td><td><em>00<\/em>&nbsp;through&nbsp;<em>23<\/em><\/td><\/tr><tr><td><em>i<\/em><\/td><td>Minutes with leading zeros<\/td><td><em>00<\/em>&nbsp;to&nbsp;<em>59<\/em><\/td><\/tr><tr><td><em>s<\/em><\/td><td>Seconds, with leading zeros<\/td><td><em>00<\/em>&nbsp;through&nbsp;<em>59<\/em><\/td><\/tr><tr><td><em>u<\/em><\/td><td>Microseconds (added in PHP 5.2.2). Note that&nbsp;<strong>date()<\/strong>&nbsp;will always generate&nbsp;<em>000000<\/em>&nbsp;since it takes an&nbsp;<a href=\"https:\/\/webnus.net\/dox\/modern-events-calendar\/all-date-formats\/language.types.integer.php\">integer<\/a>&nbsp;parameter, whereas&nbsp;<a href=\"https:\/\/webnus.net\/dox\/modern-events-calendar\/all-date-formats\/datetime.format.php\">DateTime::format()<\/a>&nbsp;does support microseconds if&nbsp;<a href=\"https:\/\/webnus.net\/dox\/modern-events-calendar\/all-date-formats\/class.datetime.php\">DateTime<\/a>&nbsp;was created with microseconds.<\/td><td>Example:&nbsp;<em>654321<\/em><\/td><\/tr><tr><td><em>v<\/em><\/td><td>Milliseconds (added in PHP 7.0.0). Same note applies as for&nbsp;<em>u<\/em>.<\/td><td>Example:&nbsp;<em>654<\/em><\/td><\/tr><tr><td><em>Timezone<\/em><\/td><td>&#8212;<\/td><td>&#8212;<\/td><\/tr><tr><td><em>e<\/em><\/td><td>Timezone identifier (added in PHP 5.1.0)<\/td><td>Examples:&nbsp;<em>UTC<\/em>,&nbsp;<em>GMT<\/em>,&nbsp;<em>Atlantic\/Azores<\/em><\/td><\/tr><tr><td><em>I<\/em>&nbsp;(capital i)<\/td><td>Whether or not the date is in daylight saving time<\/td><td><em>1<\/em>&nbsp;if Daylight Saving Time,&nbsp;<em>0<\/em>&nbsp;otherwise.<\/td><\/tr><tr><td><em>O<\/em><\/td><td>Difference to Greenwich time (GMT) in hours<\/td><td>Example:&nbsp;<em>+0200<\/em><\/td><\/tr><tr><td><em>P<\/em><\/td><td>Difference to Greenwich time (GMT) with colon between hours and minutes (added in PHP 5.1.3)<\/td><td>Example:&nbsp;<em>+02:00<\/em><\/td><\/tr><tr><td><em>T<\/em><\/td><td>Timezone abbreviation<\/td><td>Examples:&nbsp;<em>EST<\/em>,&nbsp;<em>MDT<\/em>&nbsp;&#8230;<\/td><\/tr><tr><td><em>Z<\/em><\/td><td>Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive.<\/td><td><em>-43200<\/em>&nbsp;through&nbsp;<em>50400<\/em><\/td><\/tr><tr><td><em>Full Date\/Time<\/em><\/td><td>&#8212;<\/td><td>&#8212;<\/td><\/tr><tr><td><em>c<\/em><\/td><td>ISO 8601 date (added in PHP 5)<\/td><td>2004-02-12T15:19:21+00:00<\/td><\/tr><tr><td><em>r<\/em><\/td><td><a href=\"http:\/\/www.faqs.org\/rfcs\/rfc2822\" target=\"_blank\" rel=\"noopener\">\u00bb&nbsp;RFC 2822<\/a>&nbsp;formatted date<\/td><td>Example:&nbsp;<em>Thu, 21 Dec 2000 16:01:07 +0200<\/em><\/td><\/tr><tr><td><em>U<\/em><\/td><td>Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)<\/td><td>See also&nbsp;<a href=\"https:\/\/webnus.net\/dox\/modern-events-calendar\/all-date-formats\/function.time.php\">time()<\/a><\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Here\u2019s a list of the characters you can use to display the date format you want:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","template":"","knowledgebase_cat":[49],"class_list":["post-301","knowledgebase","type-knowledgebase","status-publish","hentry","knowledgebase_cat-knowledge-other"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-json\/wp\/v2\/knowledgebase\/301","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-json\/wp\/v2\/knowledgebase"}],"about":[{"href":"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-json\/wp\/v2\/types\/knowledgebase"}],"author":[{"embeddable":true,"href":"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-json\/wp\/v2\/comments?post=301"}],"version-history":[{"count":2,"href":"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-json\/wp\/v2\/knowledgebase\/301\/revisions"}],"predecessor-version":[{"id":9855,"href":"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-json\/wp\/v2\/knowledgebase\/301\/revisions\/9855"}],"wp:attachment":[{"href":"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-json\/wp\/v2\/media?parent=301"}],"wp:term":[{"taxonomy":"knowledgebase_cat","embeddable":true,"href":"https:\/\/webnus.net\/dox\/modern-events-calendar\/wp-json\/wp\/v2\/knowledgebase_cat?post=301"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}