jQuery UI Widgets › Forums › Grid › dateformat
Tagged: cellformat, grid dateformat, jqxGrid ;
This topic contains 3 replies, has 2 voices, and was last updated by wpd 9 years, 1 month ago.
-
Authordateformat Posts
-
i am trying to show the date in my grid in 24hr format but the grid is showing in different format
here is my codevar data = ‘[{“date”: “1988-05-23T12:05:21Z”}]’;
// prepare the data
var source =
{
datatype: “json”,
datafields: [
{ name: ‘date’, type: ‘date’ }
],
localdata: data
};
var dataAdapter = new $.jqx.dataAdapter(source);
$(“#jqxgrid”).jqxGrid(
{
width: 300,
source: dataAdapter,
columns: [
{ text: ‘date’, datafield: ‘date’, cellsformat: ‘dd.MM.yyyy HH:mm:ss’ }
]
});outcome is 23.05.1988 08:05:21
i am not sure in which format it is displaying can you explain about this.
and i also what to display the time in 23.05.1988 12:05:21 can you let me know who i can do thisHello wpd,
You can read more about the date-format in our Grid ARI:
https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/index.htm#demos/jqxgrid/gridcellclass.htmGo to ‘columns’, and then go to ‘cellsformat – sets the formatting of the grid cells’. You should find helpful information there.
The outcome of your example is ‘23.05.1988 15:05:21’.
Best Regards,
StanislavjQWidgets Team
http://www.jqwidgets.com/Thank you.
But I want to display the date as 23.05.1988 12:05:21 on the grid can you please let me know how i can do this.
Here is the solution
var data = ‘[{“date”: “1988-05-23T12:05:21Z”}]’;
// prepare the data
var source =
{
datatype: “json”,
datafields: [
// you can set pattern that will match with the received data
{ name: ‘date’, type: ‘date’, format: ‘yyyy-MM-ddTHH:mm:ssZ’ }
],
localdata: data
};
var dataAdapter = new $.jqx.dataAdapter(source);$(“#jqxgrid”).jqxGrid(
{
width: 350,
source: dataAdapter,
columns: [
{
text: ‘date’, datafield: ‘date’, cellsformat: ‘dd.MM.yyyy HH:mm:ss’
}
]
});outcome:23.05.1988 12:05:21
-
AuthorPosts
You must be logged in to reply to this topic.