Date in 24 hour format in grid

Posted by: riya.katawate16 on 5 March 2019, 6:23 am EST

  • Posted 5 March 2019, 6:23 am EST

    Hi,

    I want to display date in 24 hour format. but currently its displaying in 12 hour format.

    Below is the code:

    <wj-flex-grid-column [header]=“‘Updated On’” [binding]=“‘updatedOn’” [isReadOnly]=“true” [width]=“‘*’” [format]=“‘yyyy-MM-dd hh:mm:ss’” [dataType]=“4” >

    <ng-template wjFlexGridCellTemplate [cellType]=“‘Cell’” let-cell=“cell”>

    <button type=“button” class=“detail-link” (click)=“restoreSelectedRevision($event)” [value]=“cell.item.revisionId”>{{cell.item.updatedOn | date: ‘yyyy-MM-dd hh:mm:ss’}}

    Data comming from server is 24 hour format. I want to display as it is. Please help

  • Posted 5 March 2019, 10:56 am EST

    i am getting date in 24 hour format from server I want to display same date(with 24 hour format in wijmo flex grid. Please help.

  • Posted 5 March 2019, 12:20 pm EST

    Can you check this sample to figure out the problem

    http://jsfiddle.net/rs1gx415/1/

  • Posted 6 March 2019, 1:37 am EST

    Hi All,

    Thanks @sh.koizumi for your help.

    To display the date in 24-hour format, the hour format should be ‘HH’(in capitals) rather than ‘hh’. So the complete format should be as follows:

    yyyy-MM-dd HH:mm:ss
    

    Also, you are using the angular date pipe to format the date, so that format should be according to the date format supported by angular. Please refer to the following official doc from angular for a list of supported date formats:

    https://angular.io/api/common/DatePipe

    As for wijmo, it supports .Net-style date format strings. Please refer to the following doc for more: https://demos.wijmo.com/5/Angular/WijmoHelp/WijmoHelp/topic/wijmo.Globalize.Class.html#formatDate

    ~Sharad

  • Posted 6 March 2019, 3:01 am EST

    Thanks for your help. ‘HH’(in capitals) rather than ‘hh’ worked for me.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels