简体   繁体   中英

Angular / ng-bootstrap datetime format

I need help on how to get ng-bootstrap datetimepicker, instead of just datepicker.

Thislink shows datepicker separate and timepicker separate but I want a datetimepicker instead. Here is the format that want: 2019-09-10 12:54:30.963852 .

Is there a way to get that format using ng-bootstrap?

Below is HTML example for ng-bootstrap datepicker:

<div class="form-group">
    <label>Date:</label> <input type="text" class="form-control" placeholder="yyyy-mm-dd" ngbDatepicker #d="ngbDatepicker"**strong text** required>
    <button (click)="d.toggle()"><i class="glyphicon glyphicon-calendar"></i></button>
</div>

Thanks

With normal Bootstrap you can specify the format:

format: 'Y-M-D hh:mm:ss:SSSSSS'

See this example: https://jsfiddle.net/6v8zs7a5/2/

Something like this should work with ng-bootstrap as well.

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