简体   繁体   English

需要12小时格式而不显示AM / PM Timepicker

[英]Need 12 hour format without showing AM/PM Timepicker

I am using Timepicker from Angular directive for bootstrap. 我正在使用来自Angular指令的Timepicker进行引导。

I need to have 12 hour format only but without AM/PM 我只需要12小时格式,但没有AM / PM

There is the plunkr link on the site that you can play around with. 您可以在网站上找到一个plunkr链接。

I tried the option $scope.ismeridian = false; 我尝试了$scope.ismeridian = false;选项$scope.ismeridian = false; It let the am/pm hidden but the time count goes to 24 still. 它隐藏了上午/下午,但时间计数仍为24。

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: 然后使用CSS隐藏AM / PM按钮:

.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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 12 小时 Javascript 时钟显示 24 时间,错误的 AM/PM - 12 hour Javascript Clock Showing 24 time, Wrong AM/PM 如何以12小时AM / PM格式添加24小时选项? - How to add options for 24 hours in 12 hour AM/PM format? 显示AM / PM格式的小时的另一种方式,以角度JS每小时12 AM至11 PM逐行显示表格 - Alternative way to display hour in AM/PM format in a table row-wise per hour 12 AM to 11 PM in angular JS ElementFE / ElementUI TimePicker-12小时格式 - ElementFE/ElementUI TimePicker - 12 hour format 最后使用Javascript修改的页面,其12小时制显示am或pm - Page last modified using Javascript with 12 hour clock showing am or pm 以 12 小时格式(上午 9 点至下午 6 点)而不是 24 小时显示营业时间 - Display business opening hours in 12 hour format (9am - 6pm) instead of 24 hours 如何以 12 小时 AM/PM 格式显示 JavaScript 日期时间? - How do you display JavaScript datetime in 12 hour AM/PM format? 我正在尝试使用javascript转换为12小时格式,但是当我使用取模运算符时,它将PM更改回AM - I am trying to convert to a 12 hour format in javascript, but when I use the modulo operator it changes PM back to AM 在视图侧没有AM / PM按钮的Twitter Bootstrap timepicker - Twitter Bootstrap timepicker without AM/PM button in View side 我需要验证时间的格式AM | PM - I need to validate the format of time AM|PM
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM