jQWidgets Forums

jQuery UI Widgets Forums Grid dateformat

This topic contains 3 replies, has 2 voices, and was last updated by  wpd 7 years, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    dateformat Posts
  • dateformat #96555

    wpd
    Participant

    i am trying to show the date in my grid in 24hr format but the grid is showing in different format
    here is my code

    var 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 this

    dateformat #96565

    Stanislav
    Participant

    Hello 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.htm

    Go 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,
    Stanislav

    jQWidgets Team
    http://www.jqwidgets.com/

    dateformat #96572

    wpd
    Participant

    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.

    dateformat #96628

    wpd
    Participant

    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

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.