title: How to display current date and time using ionic
body: <p>Here I am trying to develop a mobile application using an ionic framework. I want to set the current time and date in my application. But it didn't work. Can anyone help me to solve this problem?
  Here is my code.</p>
  <p>HTML code</p>
  <pre><code>&lt;ion-datetime
  #dateTime
  displayFormat=&quot;MMM DD, YYYY HH:mm&quot;
  formControlName=&quot;myDate&quot;&gt;&lt;/ion-datetime&gt;
  </code></pre>
  <p>ts. code</p>
  <pre><code>export class App{
  @ViewChild('dateTime') dateTime;
  
   form: FormGroup
   myDate: FormControl = new FormControl('', Validators.required)
  
   constructor(private fb: FormBuilder) {}
  
   ngOnInit() {
  this.form = this.fb.group({
    myDate: this.myDate
  });
  
  setTimeout(_ =&gt; {
    this.dateTime.setValue(new Date().toISOString());
    });
  }
   }
  </code></pre>