{"id":3758,"date":"2018-07-01T22:30:24","date_gmt":"2018-07-01T17:00:24","guid":{"rendered":"https:\/\/code4developers.com\/?p=3758"},"modified":"2018-07-04T11:42:37","modified_gmt":"2018-07-04T06:12:37","slug":"datepipe-in-angular","status":"publish","type":"post","link":"https:\/\/code4developers.com\/datepipe-in-angular\/","title":{"rendered":"Pipes in Angular Part &#8211; 2  : DatePipe"},"content":{"rendered":"<p>This is the second part of angular pipe series, in this part we will discuss about DatePipe. Date pipe is used to format the date value according to a locale rules. Before digging more information you can read first part of\u00a0pipe series <a href=\"https:\/\/code4developers.com\/angular-pipes\/\">here<\/a> which includes details of <a href=\"https:\/\/code4developers.com\/angular-pipes\/#lowercase\">lowercase<\/a>, <a href=\"https:\/\/code4developers.com\/angular-pipes\/#uppercase\">uppercase<\/a>, and <a href=\"https:\/\/code4developers.com\/angular-pipes\/#titlecase\">titlecase<\/a> pipes.<!--more--><\/p>\n<h3 id=\"datepipe\">DatePipe<\/h3>\n<p><strong>[blockquote]Developers wants proof of code[\/blockquote]<\/strong><\/p>\n<p>As a developer we always believe in code. So, lets take an example to understand the date pipe. Consider the below code where you want to try display current date.<\/p>\n<p><strong>app.component.ts<\/strong><\/p>\n<pre class=\"theme:github lang:default decode:true\">import { Component } from '@angular\/core';\r\n\r\n@Component({\r\n  selector: 'app-root',\r\n  templateUrl: '.\/app.component.html',\r\n  styleUrls: ['.\/app.component.css']\r\n})\r\nexport class AppComponent {\r\n  today: number = Date.now();\r\n}\r\n<\/pre>\n<p><strong>app.component.html<\/strong><\/p>\n<pre class=\"theme:github lang:default decode:true \">&lt;div style=\"text-align:center\"&gt;\r\n  &lt;p&gt;Today is : {{today}}\r\n&lt;\/div&gt;<\/pre>\n<p><strong>Output<\/strong><\/p>\n<p><img  loading=\"lazy\"  decoding=\"async\"  data-attachment-id=\"3759\"  data-permalink=\"https:\/\/code4developers.com\/datepipe-in-angular\/date-1\/\"  data-orig-file=\"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-1.png?fit=327%2C74&amp;ssl=1\"  data-orig-size=\"327,74\"  data-comments-opened=\"1\"  data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\"  data-image-title=\"DatePipe1\"  data-image-description=\"\"  data-image-caption=\"\"  data-medium-file=\"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-1.png?fit=300%2C68&amp;ssl=1\"  data-large-file=\"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-1.png?fit=327%2C74&amp;ssl=1\"  class=\"alignnone size-full wp-image-3759 pk-lazyload\"  src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUcAAABKAQMAAAASbgRCAAAAA1BMVEUAAP+KeNJXAAAAAXRSTlMAQObYZgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABlJREFUSMftwTEBAAAAwqD1T+1pCaAAAABuDCQAAThv9UYAAAAASUVORK5CYII=\"  alt=\"DatePipe1\"  width=\"327\"  height=\"74\"  data-pk-sizes=\"auto\"  data-ls-sizes=\"auto, (max-width: 327px) 100vw, 327px\"  data-pk-src=\"https:\/\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-1.png\"  data-pk-srcset=\"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-1.png?w=327&amp;ssl=1 327w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-1.png?resize=300%2C68&amp;ssl=1 300w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-1.png?resize=120%2C27&amp;ssl=1 120w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-1.png?resize=90%2C20&amp;ssl=1 90w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-1.png?resize=320%2C72&amp;ssl=1 320w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-1.png?resize=240%2C54&amp;ssl=1 240w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-1.png?resize=180%2C41&amp;ssl=1 180w\" ><\/p>\n<p>This is not in readable format. So Angular provides a pipe using which we can change it to readable format.<\/p>\n<p><strong>Syntax<\/strong><\/p>\n<div>\n<div>{{ value_expression | date [ : format [ : timezone [ : locale ] ] ] }}<\/div>\n<\/div>\n<div><\/div>\n<div>Now let&#8217;s consider below code in which we will convert date to readable format<\/div>\n<div>\n<pre class=\"theme:github lang:default decode:true \">&lt;div style=\"text-align:center\"&gt;\r\n  &lt;p&gt;Today is : {{today | date}}\r\n&lt;\/div&gt;<\/pre>\n<p><strong>Output<\/strong><\/p>\n<p><img  loading=\"lazy\"  decoding=\"async\"  data-attachment-id=\"3761\"  data-permalink=\"https:\/\/code4developers.com\/datepipe-in-angular\/date-2\/\"  data-orig-file=\"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-2.png?fit=247%2C76&amp;ssl=1\"  data-orig-size=\"247,76\"  data-comments-opened=\"1\"  data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\"  data-image-title=\"DatePipe2\"  data-image-description=\"\"  data-image-caption=\"\"  data-medium-file=\"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-2.png?fit=247%2C76&amp;ssl=1\"  data-large-file=\"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-2.png?fit=247%2C76&amp;ssl=1\"  class=\"alignnone wp-image-3761 pk-lazyload\"  src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAP+KeNJXAAAAAXRSTlMAQObYZgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=\"  alt=\"DatePipe2\"  width=\"224\"  height=\"69\"  data-pk-sizes=\"auto\"  data-ls-sizes=\"auto, (max-width: 224px) 100vw, 224px\"  data-pk-src=\"https:\/\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-2.png\"  data-pk-srcset=\"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-2.png?w=247&amp;ssl=1 247w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-2.png?resize=120%2C37&amp;ssl=1 120w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-2.png?resize=90%2C28&amp;ssl=1 90w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-2.png?resize=240%2C74&amp;ssl=1 240w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/Date-2.png?resize=180%2C55&amp;ssl=1 180w\" ><\/p>\n<p>The date is readable, but our client always asks us to format it. So Angular do have the answer for that too. Angular provides some predefined date formats, and also allow us to write our custom format.<\/p>\n<p>Consider below code in which we are applying Angular&#8217;s default &#8216;short&#8217; format<\/p>\n<pre class=\"theme:github lang:default decode:true\">&lt;div style=\"text-align:center\"&gt;\r\n  &lt;p&gt;Today is : {{today | date : 'short'}}\r\n&lt;\/div&gt;\r\n\r\n\/\/Output: Today is : 7\/1\/18, 6:46 PM<\/pre>\n<p><strong>Below is the full list of formatting options Angular provides<\/strong><\/p>\n[table style=&#8221;3&#8243;]\n[tr][th]Format[\/th] [th]Code[\/th] [th]Output Format[\/th] [th]Output[\/th][\/tr]\n[tr][td]short[\/td] [td]{{today | date : &#8216;short&#8217;}}[\/td]\u00a0[td]M\/d\/yy, h:mm a[\/td] [td]7\/1\/18, 6:58 PM[\/td][\/tr]\n[tr][td]medium[\/td] [td]{{today | date : &#8216;medium&#8217;}}[\/td]\u00a0[td]MMM d, y, h:mm:ss a[\/td] [td]Jul 1, 2018, 6:58:54 PM [\/td][\/tr]\n[tr][td]long[\/td] [td]{{today | date : &#8216;long&#8217;}}[\/td]\u00a0[td]MMMM d, y, h:mm:ss a z[\/td] [td]July 1, 2018 at 7:06:35 PM GMT+5 [\/td][\/tr]\n[tr][td]full[\/td] [td]{{today | date : &#8216;full&#8217;}}[\/td] [td]EEEE, MMMM d, y, h:mm:ss a zzzz[\/td] [td]Sunday, July 1, 2018 at 7:07:54 PM GMT+05:30 [\/td][\/tr]\n[tr][td]shortDate[\/td] [td]{{today | date : &#8216;shortDate&#8217;}}[\/td] [td]M\/d\/yy[\/td] [td]7\/1\/18[\/td][\/tr]\n[tr][td]mediumDate[\/td] [td]{{today | date : &#8216;mediumDate&#8217;}}[\/td] [td]MMM d, y[\/td] [td]Jul 1, 2018 [\/td][\/tr]\n[tr][td]longDate[\/td] [td]{{today | date : &#8216;longDate&#8217;}}[\/td] [td]MMMM d, y[\/td] [td]July 1, 2018 [\/td][\/tr]\n[tr][td]fullDate[\/td] [td]{{today | date : &#8216;fullDate&#8217;}}[\/td] [td]EEEE, MMMM d, y[\/td] [td]Sunday, July 1, 2018 [\/td][\/tr]\n[tr][td]shortTime[\/td] [td]{{today | date : &#8216;shortTime&#8217;}}[\/td] [td]h:mm a[\/td] [td]7:16 AM[\/td][\/tr]\n[tr][td]mediumTime[\/td] [td]{{today | date : &#8216;mediumTime&#8217;}}[\/td] [td]h:mm:ss a[\/td] [td]7:16:28 PM[\/td][\/tr]\n[tr][td]longTime[\/td] [td]{{today | date : &#8216;longTime&#8217;}}[\/td] [td]h:mm:ss a z[\/td] [td]7:16:28 PM GMT+5[\/td][\/tr]\n[tr][td]fullTime[\/td] [td]{{today | date : &#8216;fullTime&#8217;}}[\/td] [td]h:mm:ss a zzzz[\/td] [td]7:16:28 PM GMT+05:30 [\/td][\/tr]\n[\/table]\n<p><strong>Custom formatting options<\/strong><\/p>\n<p>You can construct a format string using symbols to specify the components of a date-time value, as described in the following table.<\/p>\n[table style=&#8221;3&#8243;]\n[tr][th]Field type[\/th][th]Format[\/th][th]Description[\/th][th]Example Value[\/th][\/tr]\n[tr][td]Era[\/td][td]G, GG, GGG[\/td][td]Abbreviated[\/td][td]AD[\/td][\/tr]\n[tr][td][\/td][td]GGGG[\/td][td]Wide[\/td][td]Anno Domini[\/td][\/tr]\n[tr][td][\/td][td]GGGGG[\/td][td]Narrow[\/td][td]A[\/td][\/tr]\n[tr][td]Year[\/td][td]y[\/td][td]Numeric: minimum digits[\/td][td]2, 20, 201, 2017, 20173[\/td][\/tr]\n[tr][td][\/td][td]yy[\/td][td]Numeric: 2 digits + zero padded[\/td][td]02, 20, 01, 17, 73[\/td][\/tr]\n[tr][td][\/td][td]yyy[\/td][td]Numeric: 3 digits + zero padded[\/td][td]002, 020, 201, 2017, 20173[\/td][\/tr]\n[tr][td][\/td][td]yyyy[\/td][td]Numeric: 4 digits or more + zero padded[\/td][td]0002, 0020, 0201, 2017, 20173[\/td][\/tr]\n[tr][td]Month[\/td][td]M[\/td][td]Numeric: 1 digit[\/td][td]9, 12[\/td][\/tr]\n[tr][td][\/td][td]MM[\/td][td]Numeric: 2 digits + zero padded[\/td][td]09, 12[\/td][\/tr]\n[tr][td][\/td][td]MMM[\/td][td]Abbreviated[\/td][td]Sep[\/td][\/tr]\n[tr][td][\/td][td]MMMM[\/td][td]Wide[\/td][td]September[\/td][\/tr]\n[tr][td][\/td][td]MMMMM[\/td][td]Narrow[\/td][td]S[\/td][\/tr]\n[tr][td]Month standalone[\/td][td]L[\/td][td]Numeric: 1 digit[\/td][td]9, 12[\/td][\/tr]\n[tr][td][\/td][td]LL[\/td][td]Numeric: 2 digits + zero padded[\/td][td]09, 12[\/td][\/tr]\n[tr][td][\/td][td]LLL[\/td][td]Abbreviated[\/td][td]Sep[\/td][\/tr]\n[tr][td][\/td][td]LLLL[\/td][td]Wide[\/td][td]September[\/td][\/tr]\n[tr][td][\/td][td]LLLLL[\/td][td]Narrow[\/td][td]S[\/td][\/tr]\n[tr][td]Week of year[\/td][td]w[\/td][td]Numeric: minimum digits[\/td][td]1&#8230; 53[\/td][\/tr]\n[tr][td][\/td][td]ww[\/td][td]Numeric: 2 digits + zero padded[\/td][td]01&#8230; 53[\/td][\/tr]\n[tr][td]Week of month[\/td][td]W[\/td][td]Numeric: 1 digit[\/td][td]1&#8230; 5[\/td][\/tr]\n[tr][td]Day of month[\/td][td]d[\/td][td]Numeric: minimum digits[\/td][td]1[\/td][\/tr]\n[tr][td][\/td][td]dd[\/td][td]Numeric: 2 digits + zero padded[\/td][td]01[\/td][\/tr]\n[tr][td]Week day[\/td][td]E, EE, &amp; EEE[\/td][td]Abbreviated[\/td][td]Tue[\/td][\/tr]\n[tr][td][\/td][td]EEEE[\/td][td]Wide[\/td][td]Tuesday[\/td][\/tr]\n[tr][td][\/td][td]EEEEE[\/td][td]Narrow[\/td][td]T[\/td][\/tr]\n[tr][td][\/td][td]EEEEEE[\/td][td]Short[\/td][td]Tu[\/td][\/tr]\n[tr][td]Period[\/td][td]a, aa, &amp; aaa[\/td][td]Abbreviated[\/td][td]am\/pm or AM\/PM[\/td][\/tr]\n[tr][td][\/td][td]aaaa[\/td][td]Wide (fallback to a when missing)[\/td][td]ante meridiem\/post meridiem[\/td][\/tr]\n[tr][td][\/td][td]aaaaa[\/td][td]Narrow[\/td][td]a\/p[\/td][\/tr]\n[tr][td]Period*[\/td][td]B, BB, &amp; BBB[\/td][td]Abbreviated[\/td][td]mid.[\/td][\/tr]\n[tr][td][\/td][td]BBBB[\/td][td]Wide[\/td][td]am, pm, midnight, noon, morning, afternoon, evening, night[\/td][\/tr]\n[tr][td][\/td][td]BBBBB[\/td][td]Narrow[\/td][td]md[\/td][\/tr]\n[tr][td]Period standalone*[\/td][td]b, bb, &amp; bbb[\/td][td]Abbreviated[\/td][td]mid.[\/td][\/tr]\n[tr][td][\/td][td]bbbb[\/td][td]Wide[\/td][td]am, pm, midnight, noon, morning, afternoon, evening, night[\/td][\/tr]\n[tr][td][\/td][td]bbbbb[\/td][td]Narrow[\/td][td]md[\/td][\/tr]\n[tr][td]Hour 1-12[\/td][td]h[\/td][td]Numeric: minimum digits[\/td][td]1, 12[\/td][\/tr]\n[tr][td][\/td][td]hh[\/td][td]Numeric: 2 digits + zero padded[\/td][td]01, 12[\/td][\/tr]\n[tr][td]Hour 0-23[\/td][td]H[\/td][td]Numeric: minimum digits[\/td][td]0, 23[\/td][\/tr]\n[tr][td][\/td][td]HH[\/td][td]Numeric: 2 digits + zero padded[\/td][td]00, 23[\/td][\/tr]\n[tr][td]Minute[\/td][td]m[\/td][td]Numeric: minimum digits[\/td][td]8, 59[\/td][\/tr]\n[tr][td][\/td][td]mm[\/td][td]Numeric: 2 digits + zero padded[\/td][td]08, 59[\/td][\/tr]\n[tr][td]Second[\/td][td]s[\/td][td]Numeric: minimum digits[\/td][td]0&#8230; 59[\/td][\/tr]\n[tr][td][\/td][td]ss[\/td][td]Numeric: 2 digits + zero padded[\/td][td]00&#8230; 59[\/td][\/tr]\n[tr][td]Fractional seconds[\/td][td]S[\/td][td]Numeric: 1 digit[\/td][td]0&#8230; 9[\/td][\/tr]\n[tr][td][\/td][td]SS[\/td][td]Numeric: 2 digits + zero padded[\/td][td]00&#8230; 99[\/td][\/tr]\n[tr][td][\/td][td]SSS[\/td][td]Numeric: 3 digits + zero padded (= milliseconds)[\/td][td]000&#8230; 999[\/td][\/tr]\n[tr][td]Zone[\/td][td]z, zz, &amp; zzz[\/td][td]Short specific non location format (fallback to O)[\/td][td]GMT-8[\/td][\/tr]\n[tr][td][\/td][td]zzzz[\/td][td]Long specific non location format (fallback to OOOO)[\/td][td]GMT-08:00[\/td][\/tr]\n[tr][td][\/td][td]Z, ZZ, &amp; ZZZ[\/td][td]ISO8601 basic format[\/td][td]-0800[\/td][\/tr]\n[tr][td][\/td][td]ZZZZ[\/td][td]Long localized GMT format[\/td][td]GMT-8:00[\/td][\/tr]\n[tr][td][\/td][td]ZZZZZ[\/td][td]ISO8601 extended format + Z indicator for offset 0 (= XXXXX)[\/td][td]-08:00[\/td][\/tr]\n[tr][td][\/td][td]O, OO, &amp; OOO[\/td][td]Short localized GMT format[\/td][td]GMT-8[\/td][\/tr]\n[tr][td][\/td][td]OOOO[\/td][td]Long localized GMT format[\/td][td]GMT-08:00[\/td][\/tr]\n[\/table]\n<p>Let us consider an example with some of the defalut and custom formatting options. For this example we will use same component from previous example.<\/p>\n<p><strong>app.component.html<\/strong><\/p>\n<pre class=\"theme:github lang:default decode:true \">&lt;div style=\"text-align:left\"&gt;\r\n  &lt;p&gt;In fullTime format : {{today | date : 'fullTime'}}\r\n  &lt;p&gt;In mediumDate format : {{today | date : 'mediumDate'}}\r\n  &lt;p&gt;In long format : {{today | date : 'long'}}\r\n  &lt;p&gt;In shortDate format : {{today | date : 'shortDate'}}\r\n  &lt;p&gt;In shortTime format : {{today | date : 'shortTime'}}\r\n  &lt;p&gt;In custom fullTime format : {{today | date : 'h:mm:ss a zzzz'}}\r\n  &lt;p&gt;In custom mediumDate format : {{today | date : 'MMM d, y'}}\r\n  &lt;p&gt;In custom long format : {{today | date : 'MMMM d, y, h:mm:ss a z'}}\r\n  &lt;p&gt;In custom shortDate format : {{today | date : 'M\/d\/yy'}}\r\n  &lt;p&gt;In custom shortTime format : {{today | date : 'h:mm a'}}\r\n&lt;\/div&gt;<\/pre>\n<p><strong>Output<\/strong><\/p>\n<p><img  loading=\"lazy\"  decoding=\"async\"  data-attachment-id=\"3775\"  data-permalink=\"https:\/\/code4developers.com\/datepipe-in-angular\/finaloutput\/\"  data-orig-file=\"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/FinalOutput.png?fit=626%2C572&amp;ssl=1\"  data-orig-size=\"626,572\"  data-comments-opened=\"1\"  data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\"  data-image-title=\"DatePipeFinalOutput\"  data-image-description=\"\"  data-image-caption=\"\"  data-medium-file=\"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/FinalOutput.png?fit=300%2C274&amp;ssl=1\"  data-large-file=\"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/FinalOutput.png?fit=626%2C572&amp;ssl=1\"  class=\"alignnone wp-image-3775 pk-lazyload\"  src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAP+KeNJXAAAAAXRSTlMAQObYZgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII=\"  alt=\"DatePipeFinalOutput\"  width=\"586\"  height=\"535\"  data-pk-sizes=\"auto\"  data-ls-sizes=\"auto, (max-width: 586px) 100vw, 586px\"  data-pk-src=\"https:\/\/code4developers.com\/wp-content\/uploads\/2018\/07\/FinalOutput.png\"  data-pk-srcset=\"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/FinalOutput.png?w=626&amp;ssl=1 626w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/FinalOutput.png?resize=300%2C274&amp;ssl=1 300w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/FinalOutput.png?resize=120%2C110&amp;ssl=1 120w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/FinalOutput.png?resize=90%2C82&amp;ssl=1 90w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/FinalOutput.png?resize=320%2C292&amp;ssl=1 320w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/FinalOutput.png?resize=560%2C512&amp;ssl=1 560w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/FinalOutput.png?resize=240%2C219&amp;ssl=1 240w, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/FinalOutput.png?resize=180%2C164&amp;ssl=1 180w\" ><\/p>\n<p><strong>Summary <\/strong><\/p>\n<p>Only the en-US locale data comes with Angular. To localize dates in another language, you must import the corresponding locale data. In next part we will get information on <a href=\"https:\/\/code4developers.com\/currencypipe-percentpipe\/\">CurrencyPipe, PercentPipe<\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This is the second part of angular pipe series, in this part we will discuss about DatePipe. Date pipe is used to format the date value according to a locale&hellip;<\/p>\n","protected":false},"author":4,"featured_media":2649,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[28],"tags":[29,173,179,194],"powerkit_post_featured":[],"class_list":{"0":"post-3758","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-angular","8":"tag-angular","9":"tag-angular-5","10":"tag-angular-6","11":"tag-angular-pipes"},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/06\/angular-2.png?fit=240%2C240&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8NAi4-YC","jetpack-related-posts":[{"id":3746,"url":"https:\/\/code4developers.com\/angular-pipes\/","url_meta":{"origin":3758,"position":0},"title":"Pipes in Angular Part &#8211; 1 : lowercase, uppercase, and titlecase pipes","author":"Yatendrasinh Joddha","date":"June 30, 2018","format":false,"excerpt":"In this series of article for the angular rookies we will discuss about pipes in Angular, a way to write display-value transformations that you can declare in your HTML. In this article we will discuss about lowercase, uppercase, and titlecase pipes. At the end of the series we will create\u2026","rel":"","context":"In &quot;Angular&quot;","block_context":{"text":"Angular","link":"https:\/\/code4developers.com\/category\/angular\/"},"img":{"alt_text":"example output","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/06\/example-output.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":4091,"url":"https:\/\/code4developers.com\/create-custom-pipes-aka-filters-in-angular-2-x\/","url_meta":{"origin":3758,"position":1},"title":"Create Custom Pipes &#8211; Filters in Angular 2.X +","author":"Arif Khoja","date":"March 10, 2019","format":false,"excerpt":"Our applications may have a lot of data for presentation, But for creating a good user experience it is preferable to see in a more understandable format like March 12, 2010 is better to read then Mon Mar 12 2010 15:23:40 GMT-0700 (Pacific Daylight Time). For such small and repeated\u2026","rel":"","context":"In &quot;Angular&quot;","block_context":{"text":"Angular","link":"https:\/\/code4developers.com\/category\/angular\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/06\/angular-2.png?fit=240%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3818,"url":"https:\/\/code4developers.com\/slicepipe-jsonpipe-asyncpipe\/","url_meta":{"origin":3758,"position":2},"title":"Pipes in Angular Part \u2013 4 : SlicePipe, JSONPipe, AsyncPipe","author":"Yatendrasinh Joddha","date":"August 19, 2018","format":false,"excerpt":"Here is the fourth part of angular pipe series in this part we will discuss about SlicePipe, JSONPipe, and AsyncPipe. If you have not read previous articles here is the link for previous articles. Pipes in Angular Part \u2013 1 : lowercase, uppercase, and titlecase pipes Pipes in Angular Part\u2026","rel":"","context":"In &quot;Angular&quot;","block_context":{"text":"Angular","link":"https:\/\/code4developers.com\/category\/angular\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/06\/angular-2.png?fit=240%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3779,"url":"https:\/\/code4developers.com\/currencypipe-percentpipe\/","url_meta":{"origin":3758,"position":3},"title":"Pipes in Angular Part \u2013 3 : CurrencyPipe, PercentPipe","author":"Yatendrasinh Joddha","date":"July 3, 2018","format":false,"excerpt":"Here is the third installment of angular pipe series in this part we will discuss about CurrencyPipe, and PercentPipe, If you have not read previous articles here is the link for previous articles. Pipes in Angular Part \u2013 1 : lowercase, uppercase, and titlecase pipes Pipes in Angular Part \u2013\u2026","rel":"","context":"In &quot;Angular&quot;","block_context":{"text":"Angular","link":"https:\/\/code4developers.com\/category\/angular\/"},"img":{"alt_text":"digitsInfo","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/digitsInfo.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/digitsInfo.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/digitsInfo.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/digitsInfo.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2018\/07\/digitsInfo.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":2625,"url":"https:\/\/code4developers.com\/angular-4-project-structure\/","url_meta":{"origin":3758,"position":4},"title":"Angular 4 Project Structure","author":"Nisarg Dave","date":"June 18, 2017","format":false,"excerpt":"Introduction In previous article we learned about Angular 4 Installation. You can find that article on https:\/\/code4developers.com\/angular-4-installations\/\u00a0. This article describes the project structure of Angular 4 application which Angular CLI created for us. I have already created ANGULAR4DEMO project in my previous article, so we will use that project to\u2026","rel":"","context":"In &quot;Angular&quot;","block_context":{"text":"Angular","link":"https:\/\/code4developers.com\/category\/angular\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2017\/06\/1-1.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":14480,"url":"https:\/\/code4developers.com\/angular-custom-elements\/","url_meta":{"origin":3758,"position":5},"title":"Angular Custom Elements: Creating Reusable Components with Angular","author":"Yatendrasinh Joddha","date":"April 19, 2023","format":false,"excerpt":"Angular Custom Elements allow you to create reusable components that can be used in non-Angular applications. Custom Elements are a powerful feature that can help you share code across multiple projects and platforms. In this article, we'll take a closer look at Angular Custom Elements and show you how to\u2026","rel":"","context":"In &quot;Angular&quot;","block_context":{"text":"Angular","link":"https:\/\/code4developers.com\/category\/angular\/"},"img":{"alt_text":"Angular Custom Elements","src":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2023\/04\/Custom-elements.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2023\/04\/Custom-elements.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2023\/04\/Custom-elements.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2023\/04\/Custom-elements.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/code4developers.com\/wp-content\/uploads\/2023\/04\/Custom-elements.png?resize=1050%2C600&ssl=1 3x"},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/posts\/3758","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/comments?post=3758"}],"version-history":[{"count":18,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/posts\/3758\/revisions"}],"predecessor-version":[{"id":3810,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/posts\/3758\/revisions\/3810"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/media\/2649"}],"wp:attachment":[{"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/media?parent=3758"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/categories?post=3758"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/tags?post=3758"},{"taxonomy":"powerkit_post_featured","embeddable":true,"href":"https:\/\/code4developers.com\/wp-json\/wp\/v2\/powerkit_post_featured?post=3758"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}