Richie
Richie

Reputation: 5189

javascript date format strings

I have a date being returned in a json result that looks like this...

2014-11-24T16:59:59

In my jqgrid I need to specify the input date string for this date and also the output format i.e. how it will look like on the grid.

    formatoptions: {
        srcformat: 'Y-m-d',
        newformat: 'd/m/y hh:mi:ss'
    },

I would like the grid to have an output date format with the "T" removed and the time date and portion displayed like this.

2014-11-22 16:59:59

Can someone help me with how I should specify this in the format options. i.e. How the date strings should looke like. I've been looking around with no success.

thanks

Upvotes: 0

Views: 206

Answers (1)

caslaner
caslaner

Reputation: 413

Please use like this :

formatter: 'date',
formatoptions: {
            srcformat: 'ISO8601Long',
            newformat: 'd/m/Y H:i:s'
}

Jsfiddle Example

Upvotes: 1

Related Questions