简体   繁体   中英

Need 12 hour format without showing AM/PM Timepicker

I am using Timepicker from Angular directive for bootstrap.

I need to have 12 hour format only but without AM/PM

There is the plunkr link on the site that you can play around with.

I tried the option $scope.ismeridian = false; It let the am/pm hidden but the time count goes to 24 still.

Thanks for any help.

Apply a class to your timepicker:

<timepicker class="timepicker" ng-model="mytime" ng-change="changed()" hour-step="hstep" minute-step="mstep" show-meridian="ismeridian"></timepicker>

And then use CSS to hide the AM/PM button:

.timepicker tr:nth-child(2) td:last-child {
   display: none;
}

On the plunker link try to change this line:

<pre class="alert alert-info">Time is: {{mytime | date:'shortTime' }}</pre>

to this:

<pre class="alert alert-info">Time is: {{mytime | date:'HH:mm' }}</pre>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM