jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Cellformat shows wrong results
Tagged: date formatting of Grid
This topic contains 6 replies, has 2 voices, and was last updated by punkrack 12 years ago.
-
Author
-
Hi!
I have in my database, a timestamp : 2013-06-14 12:38:47. This is 12:38 has in “noon:38”
For that column, I have a cellsformat: ‘d MMMM yyyy, HH:mm tt
which displays properly EXCEPT, the time is ‘wrong’. Instead of being 12:38 PM, it shows 00:38 AM.
If it’s 13:00, it shows 13:00 PM.
The type is ‘date’ for that datafield.
EDIT: BTW, it displays properly in chrome (12:38 PM), but does not in Firefox and IE (10)
Hi,
HH is used for 24 hours formatting. For 12 hours formatting, use hh as a format string.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi!
Thanks for the reply.I need 24h formating.
My cellsformat is : cellsformat: ‘d MMMM yyyy, HH:mm’Like I mentionned, in the 24 hours formatting, “noon” puts 00 but it should put 12 with the 24 hour format.
See print screens provided (Firefox wrong, chrome ok)
Hi,
We will investigate whether we have or not such issue with the latest version and in case we reproduce it, we will resolve it as soon as possible. As a workaround, you may use the custom cells rendering capabilities of the Grid to render its values instead of the built-in rendering.
Another option which you may try:
var source = { localdata: data, datatype: "array", datafields: [ { name: 'available', type: 'date', format: 'd MMMM yyyy, HH:mm tt' } ] }; var dataAdapter = new $.jqx.dataAdapter(source); $("#jqxgrid").jqxGrid( { width: 670, source: dataAdapter, theme: theme, columnsresize: true, columns: [ { text: 'Date', datafield: 'available', cellsalign: 'right', cellsformat: 'd MMMM yyyy, HH:mm tt' } ] });
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com2nd solution does not work.
Thanks for the replies!
I will wait and see at this point if you guys get the same error.Hi,
The second solution is tested with the current version of jQWidgets and with the Date string from your post: “2013-06-14 12:38:47” and it displays it correctly formatted. Please, check the version of jQWidgets that you use on your side.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comYes, I upgraded to the latest version and now it’s fixed.
Thanks! -
AuthorPosts
You must be logged in to reply to this topic.