How to change date format in jqgrid
Asked Answered
A

3

9

I have one issue related to jqgrid. I have date shown in jqgrid table like "FRI MAY 17 00:00:00 IST 2013" .I want to change its format to "17/5/2013".how i can do it?

{name:'checkin', index:'checkin', width:60, searchoptions:{sopt:['eq']}},

this is my code.

Agriculturist answered 18/5, 2013 at 11:50 Comment(7)
What is the input format of the data which you use to fill the grid? Recommended source format is ISO8601Short ("Y-m-d" like "2013-05-18") or ISO8601Long ("Y-m-d H:i:s" like "2013-05-18 14:13:53")Windrow
@Windrow : I am using input fomat as date.Agriculturist
My question was which input format you use?. You wrote only in which format you shown the date, but not in which format you fill the data for the grid. Do you use datatype: "local" and fill the data in your JavaScript code or you use datatype: "json" (or "xml") and returns data from the server?Windrow
@Oleg: oh sorry for mistake. I have used datatype : "json".Agriculturist
which input format for data you use?Windrow
@Oleg: I am sending date object as "String"(i.e.milliseconds) from server and in JavaScript code I am using datatype: "json"Agriculturist
@Oleg: My date is like "FRI MAY 17 00:00:00 IST 2013" ,where "IST" is "TimeZone",but I dont know what is its source format.Agriculturist
D
17

Try these:

formatter: 'date', formatoptions: { srcformat: 'd/m/Y', newformat: 'd/m/Y'}

Given here: JQgrid json date format

Downwards answered 18/5, 2013 at 12:25 Comment(2)
if that is the case how to change this format 2014-06-11 10:06:41.0 to 11/06/2014 10:06:41 in JqGrid ? Please help.. ThanksWits
please check it this link trirand.com/jqgridwiki/doku.php?id=wiki:predefined_formatterDownwards
G
0

Try this!!!

{name:'checkin', index:'checkin', width:60, formatter: 'date', 
     formatoptions: { newformat: 'd/m/Y'}, 
     searchoptions:{sopt:['eq']}},
Gibbie answered 16/10, 2013 at 9:6 Comment(0)
T
0

Try this one:

formatter: 'date', formatoptions: { srcformat: 'l, F d, Y', newformat: 'd/m/Y'}
Tuner answered 28/1, 2014 at 6:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.