Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
date formatter question
02/11/2010
21:23
Avatar
cwillard
Member
Members
Forum Posts: 6
Member Since:
02/11/2010
sp_UserOfflineSmall Offline

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?

03/11/2010
15:33
Avatar
cwillard
Member
Members
Forum Posts: 6
Member Since:
02/11/2010
sp_UserOfflineSmall Offline

anyone?

03/11/2010
16:14
Avatar
OlegK
Germany
Member
Members
Forum Posts: 1255
Member Since:
10/08/2009
sp_UserOfflineSmall Offline

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"?

03/11/2010
17:23
Avatar
cwillard
Member
Members
Forum Posts: 6
Member Since:
02/11/2010
sp_UserOfflineSmall Offline

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.

Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information