1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Format date as dd/MM/yyyy using pipes

Discussão em 'Angular' iniciado por Jp_, Julho 2, 2025.

  1. Jp_

    Jp_ Guest

    I'm using the date pipe to format my date, but I just can't get the exact format I want without a workaround. Am I understanding pipes wrongly or is just not possible?

    //our root app component
    import {Component} from 'angular2/core'

    @Component({
    selector: 'my-app',
    providers: [],
    template: `
    <div>
    <h2>Hello {{name}}</h2>
    <h3>{{date | date: 'ddMMyyyy'}}, should be
    {{date | date: 'dd'}}/{{date | date:'MM'}}/{{date | date: 'yyyy'}}</h3>

    </div>
    `,
    directives: []
    })
    export class App {
    constructor() {
    this.name = 'Angular2'
    this.date = new Date();
    }
    }


    plnkr view

    Continue reading...

Compartilhe esta Página