简体   繁体   English

如何设置ion-datetime的默认时间?

[英]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.

相关问题 如何自动将我的 ion-datetime 设置为今天的日期,而无需事先单击选择器? - How do I set my ion-datetime to today's date automatically without needing to click the picker beforehand? 离子性 <ion-item> 之间 <ion-label> 和 <ion-datetime> 没有出现 - Ionic <ion-item> between <ion-label> and <ion-datetime> not showing up Ionic 4,Angular:显示“确定”和“取消”按钮时出现问题 <ion-datetime> , <ion-select> - Ionic 4, Angular: problems showing OK and Cancel buttons with <ion-datetime>, <ion-select> 如何设置离子选项的默认选择值? - How to set default selected value of ion-option? 如何设置默认值离子选择项? - How to set default value ion-select item? 默认情况下如何设置HTML日期时间输入值 - How to set the HTML datetime input a value by default Nuxtjs/Vuejs 为 datetime-local 类型的输入字段设置默认日期时间为当前日期时间 - Nuxtjs/Vuejs set the default date time as current date time for the input field of type datetime-local 如何使用 Javascript 在输入标签上设置默认日期时间戳? - How to set a default datetime stamp on an input tag using Javascript? 在选择带有“datetime-local”输入的日期后,是否可以将时间设置为默认值? - Is it possible to set the time to a default value after picking a date with a "datetime-local" input? 如何设置高度<ion-img> - How to set height on <ion-img>
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM