title: ngbDatepicker date format : YYYY-MM-DD
body: <p>I am using Angular 5 for my project.So I have date input field in form for this I am using NgbDatepicker but I am unable to set the yyyy-mm-dd format.And also when I am selecting date , it is showing One day before date.Please help me out.</p>
  
  <pre><code>&lt;form class="form-inline"&gt;
      &lt;div class="form-group"&gt;
        &lt;div class="input-group"&gt;
          &lt;input class="form-control" placeholder="yyyy-mm-dd"
                 name="d2" #c2="ngModel" [(ngModel)]="model2" ngbDatepicker #d2="ngbDatepicker"&gt;
          &lt;div class="input-group-append"&gt;
            &lt;button class="btn btn-outline-secondary" (click)="d2.toggle()" type="button"&gt;
              calender
            &lt;/button&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/form&gt;
    &lt;hr/&gt;
    &lt;pre&gt;Model: {{ model2 | json }}&lt;/pre&gt;
  </code></pre>
  
  <p>app.component.ts</p>
  
  <pre><code>import { Component, OnInit, Injectable } from '@angular/core';
  import { HttpClient } from '@angular/common/http';
  import {Observable} from 'rxjs/Observable';
  import 'rxjs/add/observable/timer';
  import 'rxjs/add/operator/map';
  import 'rxjs/add/operator/take';
  @Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: ['./app.component.css']
  })
  export class AppComponent implements OnInit {
  model2: Date;
  }
  </code></pre>
  
  <p>output: Model: "2018-01-31T18:30:00.000Z" , here I have selected 2018-02-01</p>