title: how to change NgbDatePicker format from YYYY-MM-DD to MM-DD-YYYY angular 4?
body: <p>hi i am using ngbDatePicker and my format is YYYY-MM-DD 
  and i am trying to change it but cant seem to change the format to MM/DD/YYYY.</p>
  
  <p><strong>here is my html code</strong></p>
  
  <pre><code>    &lt;div class="form-group datepicker"&gt;
        &lt;label for="dob"&gt;Date of Birth*&lt;/label&gt;
        &lt;div class="row input-group"&gt;
          &lt;input
            ngbDatepicker
            #d="ngbDatepicker"
            #dobF="ngModel"
            class="form-control input-underline input-lg"
            id="dob"
            [(ngModel)]="dateOfBirth"
            placeholder="mm-dd-yyyy"
            name="dp"
            [ngClass]="{
              invalid:
                (dobF.value === null || isString(dobF.value) || futureDate) &amp;&amp; dobF.touched
            }"
            required
          /&gt;
          &lt;div class="input-group-append"&gt;
            &lt;button
              class="btn btn-outline-secondary calendar"
              (click)="d.toggle()"
              type="button"
            &gt;&lt;/button&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div
          *ngIf="
            (dobF.value === null || isString(dobF.value)  || futureDate) &amp;&amp; dobF.touched
          "
          class="error"
        &gt;
          Please enter a valid date of birth.
        &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p><strong>here is my ts file code</strong></p>
  
  <pre><code>  public dateOfBirth: { year: number; month: number; day: number };
  
    public currentDate = moment().format("YYYY-MM-DD");
  
  
  
  constructor(
  private config: NgbDatepickerConfig
   ) {
  // customize default values of datepickers used by this component tree
  const currentDate = new Date();
    const day = currentDate.getDate();
     const month = currentDate.getMonth() + 1;
    const year = currentDate.getFullYear();
  
   this.config.minDate = {year: 1900, month: 1, day: 1};
   this.config.maxDate = {year, month, day};
  
   this.config.outsideDays = "hidden";
  }
  
  ngOninit() {
  
    this.subscriptions["patient"] = this.store
     .select("patient")
     .subscribe(data =&gt; {
      this.patient = Object.assign({}, this.patient, data);
      const dob = this.patient.Dob ? this.patient.Dob.split("-") : null;
      dob !== null
        ? (this.dateOfBirth = {
          year: Number(dob[0]),
          month: Number(dob[1]),
          day: Number(dob[2])
        })
        : (this.dateOfBirth = null);
    });
   }
  
  ngAfterContentChecked() {
  let currentDateObject = this.currentDate.split("-");
  this.dobYear = Number(currentDateObject[0]);
  this.dobMonth = Number(currentDateObject[1]);
  this.dobDay = Number(currentDateObject[2]);
  if (this.dateOfBirth) {
    this.futureDate = this.dateOfBirth.year &gt; this.dobYear || (this.dateOfBirth.year == this.dobYear &amp;&amp; this.dateOfBirth.month &gt; this.dobMonth)
      || (this.dateOfBirth.year == this.dobYear &amp;&amp; this.dateOfBirth.month == this.dobMonth &amp;&amp; this.dateOfBirth.day &gt; this.dobDay);
      }
    }
  </code></pre>
  
  <p>i cannot seem to find any help to change the format.
  how can i change the format from YYYY/DD/MM toMM/DD/YYYY.
  is there any help thanks</p>