<ion-datetime displayFormat=“DD-MM-YYYY” [(ngModel)]=“todo.myDate”></ion-datetime>
Ionic 4 DateTime picker shows the GMT time. But my local time is GMT+6. I’m not getting the exact time.
<ion-datetime displayFormat=“DD-MM-YYYY” [(ngModel)]=“todo.myDate”></ion-datetime>
Ionic 4 DateTime picker shows the GMT time. But my local time is GMT+6. I’m not getting the exact time.
try this example:
<ion-datetime displayFormat="DD-MM-YYYY" pickerFormat="DD/MMM/YYYY" [(ngModel)]="selectedDate"></ion-datetime>
import { Component } from '@angular/core';
import { NavController, ToastController, AlertController } from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
selectedDate: string;
constructor( ) {
// use ISO date format
this.selectedDate = new Date().toISOString();
}