How to change Mat-Datepicker date format to DD/MM/YYYY in simplest way?

后端 未结 9 1418
孤城傲影
孤城傲影 2021-02-07 09:00

I\'m setting up a mat-datepicker for DOB and traditionally the display format is MM/DD/YYYY,I need to change it to DD/MM/YYYY with less coding

I tried format tag in mat

9条回答
  •  梦毁少年i
    2021-02-07 09:13

    use dateadapter from core

    import { DateAdapter } from '@angular/material/core';
    
    constructor(private dateAdapter: DateAdapter) {
        this.dateAdapter.setLocale('en-GB'); //dd/MM/yyyy
    
    }
    

    `

提交回复
热议问题