jQuery UI Widgets › Forums › Grid › wrong data format
Tagged: angular grid, database, datafield, date, format, grid, jquery grid, jqxgrid, timestamp
This topic contains 2 replies, has 2 voices, and was last updated by Dimitar 9 years, 5 months ago.
-
Authorwrong data format Posts
-
Hi,
i’m loading a grid from db2 using odbc.
I have a field which contains a date and the grid configured like:
datafields: [ { name: 'Data_Bolla', type: 'date' }, .. localization: getLocalization('it'), .. columns: [ { text: 'Data', dataField: 'Data_Bolla', width: 250, cellsformat: 'dd/MM/yyyy' },
the database field contains a correct date, which is:
02/01/2015 00:00:00
29/06/2015 00:00:00the problem is that on the grid I see:
01/01/2015
06/06/2015it looks like that the grid uses the months for both the day and the months.
i even configured the file localization.js like this:
patterns: { // short date pattern d: "dd/MM/yyyy", // long date pattern D: "dddd, MMMM dd, yyyy", // short time pattern t: "hh:mm tt", // long time pattern T: "hh:mm:ss tt", // long date, short time pattern f: "dddd, MMMM dd, yyyy hh:mm tt", // long date, long time pattern F: "dddd, MMMM dd, yyyy hh:mm:ss tt", // month/day pattern M: "MMMM dd", // month/year pattern Y: "yyyy MMMM", // S is a sortable format that does not vary by culture S: "yyyy\u0027-\u0027MM\u0027-\u0027dd\u0027T\u0027HH\u0027:\u0027mm\u0027:\u0027ss", // formatting of dates in MySQL DataBases ISO: "yyyy-MM-dd hh:mm:ss", ISO2: "yyyy-MM-dd HH:mm:ss", d1: "dd.MM.yyyy", d2: "dd-MM-yyyy", d3: "dd-MMMM-yyyy", d4: "dd-MM-yy", d5: "H:mm", d6: "HH:mm", d7: "HH:mm tt", d8: "dd/MMMM/yyyy", d9: "MMMM-dd", d10: "MM-dd", d11: "MM-dd-yyyy" },
what could be wrong?
thank you!
I solved it !
the problem is with the field type.
Using this query:
select to_date(cast(bodtb as char(8)),’YYYYMMDD’) as field1 from ..
the field returned is a TimeStamp (it has also the time).
changing the query like
select date(to_date(cast(bodtb as char(8)),’YYYYMMDD’)) as field1 from ..
made the trick.
I think there’s a bug in the grid though, because it should have worked also before, am i wrong?
thanks !
Hi lorife,
You may have needed to set the “Data_Bolla”‘s format property, too. It helps the data adapter load the data by specifying the datafield’s format in the data source (i.e., timestamp).
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.