ssp
ssp

Reputation: 19

how to display the date value in the format YYYY-MM-DD in the jqxgrid?

I have to obtain the date value from the database which is given in the format YYYY-MM-DD and display in the jqxgrid in the same format,,,

I have used the following code:

text : ‘Start Date’, id: ‘startDatePopUp’,datafield : ‘startDate’, columntype: ‘datetimeinput’, cellsformat: ‘YYYY-MM-DD’, align : ‘center’, width : 150, cellsalign : ‘center’,

but it is being displayed in the grid as YYYY-MM-DD 00:00:00.0

how will I display the date value in the format YYYY-MM-DD in the jqxgrid??

Thanks & Regards,

ssp

Upvotes: 0

Views: 2308

Answers (3)

user3129015
user3129015

Reputation:

here's a working sample for you .....

https://jsfiddle.net/Vinod1/by6duep4/10/

and this is the specific part of the sample code.

{
  text: 'Date',
  datafield: 'date', 
  filtertype: 'date', 
  cellsalign: 'right', 
  width: '100', 
  cellsformat: 'yyyy/MM/dd' }

Upvotes: 0

Rei
Rei

Reputation: 41

In the source try adding the following attributes.

{ name: 'LastLoginDate', type: 'date', format: 'd' },

Then in the Cell definition.

{ text: 'Last Activity', datafield: 'LastLoginDate', cellsformat: 'yyyyy-MM-dd' },

Upvotes: 2

Zuhair
Zuhair

Reputation: 287

Try adding the 'format' in the source like

var source={
       datafield:[
                   { name: 'startDate',type:'date',format:'yyyy/MM/dd' }
                 ]
}

Upvotes: 1

Related Questions