jQWidgets Forums

jQuery UI Widgets Forums Grid show dates with a day wrong.

This topic contains 2 replies, has 2 voices, and was last updated by  gusanomaly 9 years, 9 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • show dates with a day wrong. #74826

    gusanomaly
    Participant

    Hello,

    I have in my database (MySQL) records with simple dates in this format: YYYY-MM-DD
    If I have a record with the data like ‘2015-08-14′ when I show in Jqxgrid put: ’13-08-2015’. Rest one day.

    I’have formated the rows like this:

    //in source:
    { name: ‘fecha_inicio’, type: “date”, format: ‘dd-MM-yyyy’ },

    //in grid:
    { text: ‘Fec Inicio’, dataField: ‘fecha_inicio’, cellsalign: ‘center’, width: ‘16%’, cellsformat: ‘dd-MM-yyyy’ },

    If I see with a debuger, my json data is fine.

    Thank you for the help.
    Best regards,
    Gustav Dunn.

    show dates with a day wrong. #74828

    Peter Stoev
    Keymaster

    Hi Gustav Dunn,

    Load your dates using the same Time Zone i.e include Time Zone information and make the client to request a date from the server using a Date Format which includes Time Zone. Otherwise, you will have differences due to the Fact that your DB is in 1 Time Zone and your Local Machine is in another and JavaScript always displays dates in Local Time Zone. How to load dates using specific Date format is illustrated on http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-datasources.htm

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    show dates with a day wrong. #74921

    gusanomaly
    Participant

    Hello Peter,

    thank you for the answer. I could find my problem:

    In my source I put this:
    { name: ‘fecha_inicio’, type: “date”, format: ‘dd-MM-yyyy’ },

    But in my MySQL the format date is ‘yyyy-MM-dd’… In the source I’ve to put the same format as my database and in my grid I’ve to put the format that I want to see.

    See you!
    Gustav Dunn.

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

You must be logged in to reply to this topic.