Forum


21:23

02/11/2010

I am attempting to convert dates from one format in JSON to a different format for display. I am using the newest version of jqGrid with jquery1.4.3.
Here is the relevant code:
colModel: [
...
{ name: 'lastAllocation', index: 'lastAllocation', formatter: 'date', formatoptions: { srcformat: 'YmdHi', newformat: 'd/m/Y g:ia' } },
...
]
The date I'm trying to convert is "201008120610", but what is being displayed is 01/01/1970 12:00am. It seems like perhaps the lack of spaces is what is causing the problem.
Does anyone know anything about this and what I might be doing wrong?
16:14

10/08/2009

It seem to me that your source date format is too bad to be interpreted by the standard date formatter. With the writing your custom formatter you will be able to read the date. Why you not use ISO8601Long format "Y-m-d H:i:s"?
17:23

02/11/2010

OlegK said:
It seem to me that your source date format is too bad to be interpreted by the standard date formatter. With the writing your custom formatter you will be able to read the date. Why you not use ISO8601Long format "Y-m-d H:i:s"?
Well, I just thought a timestamp like 201011031122 would be simple to get from the server. I can use another format. I was just surprised that it was not able to be converted. I would think if this is using a regex, it should be able to handle any format, even ones without spaces.
Thx for the feedback.
Most Users Ever Online: 715
Currently Online:
56 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66