Format TIME in listGrid

Hi,
I want to show in one cellGrid the hour with a format. Example: 17:45 Hrs. How I do it?

Thanks.

Hi
If you specify a field in your ListGrid (or dataSource) as having type:“time”, you can use the ListGrid.timeFormatter to specify a standard formatter from this list: valid timeFormatters.

So using a time-formatter of toShort24HourTime would give you a value in the format 17:45.

If you want a more customized rendition of your time, you can override formatCellValue() on the field in question, possibly making use of the Time.toTime() method to come up with the basic 24 hour time string, and then modifying it.

  • for example:
ListGrid.create({
    ... // various properties
    fields: [
        {name:"timeField", type:"time", 
         formatCellValue: function (value) {
             // Time fields are implemented as javascript dates
             // on the client
             if (isc.isA.Date(value)) {
                 value = isc.Time.toTime(value, 'to24HourTime') + ' Hrs';
             }
             return value;
         }
        }

        ... // other fields
    ]
})

Ok,

Thanks for the help!!!