[英]How to set default time of ion-datetime?
I am trying to set the default time of this datetime picker to 0800. Any idea how i can do this? 我正在尝试将此日期时间选择器的默认时间设置为0800。任何想法我该怎么做?
<ion-label floating>Time: From</ion-label>
<ion-datetime displayFormat="HH:mm" pickerFormat="HH:mm" [(ngModel)]="request.from" ></ion-datetime>
try something like : 尝试类似的东西:
<ion-item>
<ion-label>Date</ion-label>
<ion-datetime displayFormat="MM/DD/YYYY" [(ngModel)]="myDate"></ion-datetime>
</ion-item>
JS: JS:
$scope.myDate = "2017-08-08 11:22:00";
In my case, I'll receive the wrong date format from the DB side. 就我而言,我将从数据库端收到错误的日期格式 。 So, will change to the below formate.
因此,将更改为以下格式。 and it will work like other normal variables no extra settings or anything will be required for that.
它将像其他普通变量一样工作,不需要任何额外的设置,也不需要任何其他设置。
<ion-item>
<ion-label>Date</ion-label>
<ion-datetime displayFormat="MM/DD/YYYY" [(ngModel)]="myDate"></ion-datetime>
</ion-item>
Date format for ion-datetime
must be like: ion-datetime
日期格式必须类似于:
this.myDate = 2018-12-24T13:03:38.136Z;
So, make sure you are receiving valid date formate. 因此,请确保您收到有效的日期甲酸盐。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.