سؤال

I have got this time stamp: 1400000000, which is 05/13/2014. Is there a way to display this in my grid, panel or dialog as a m/d/Y.

  config.cm =  new Ext.grid.ColumnModel({
    defaults:{
        sortable: true
    },
    columns :  [{ 
        {
        header: 'date',
        dataIndex: 'time',
        editable:'false'
    }]
});

Is there any way to show epoch time as dateformat?

هل كانت مفيدة؟

المحلول

I think you can do something like this :

config.cm =  new Ext.grid.ColumnModel({
    defaults:{
        sortable: true
    },
    columns :  [{ 
        {
        header: 'date',
        dataIndex: 'time',
        editable:'false',
        renderer: formatDate
    }]
});

function formatDate(value){
    return value ? value.dateFormat('M d, Y') : '';
}

Hopefully that helps you!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top