How to format date when using primeng calendar?

Discussão em 'Angular' iniciado por Ke Vin, Fevereiro 6, 2025.

  1. Ke Vin

    Ke Vin Guest

    How to get only date,month and year when using Prime NG p-calendar component? i got these value when i do console.log my variable. It showed this value :


    Date {Wed Feb 01 2017 00:00:00 GMT+0700 (SE Asia Standard Time)}
    ​

    So i don't want it that long, i just need 01/02/2017, i don't need the rest. So how can i get date,month and year format? since i already did this :

    here is my html :

    and here is my component.ts :

    export class report {

    public date: any;


    constructor() {

    }

    public proses(date) {

    console.log(date);

    }

    }

    Continue reading...

Compartilhe esta Página