jQuery UI Widgets Forums Grid jqxGrid date formating

This topic contains 20 replies, has 4 voices, and was last updated by  jgarcias 8 years, 10 months ago.

Viewing 6 posts - 16 through 21 (of 21 total)
  • Author
  • jqxGrid date formating #55512

    Peter Stoev
    Keymaster

    Hi Emre,

    The Grid works with JavaScript Date Objects. If you don’t pass TimeZone information to the JavaScript Date object’s constructor, it will Parse your Date to a Local TimeZone and as far as I know, you cannot prevent this.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    jqxGrid date formating #55518

    Peter Stoev
    Keymaster

    Additional info:

    When you create a new date, without specifying a time zone, Javascript will create the date using the browser’s timezone. When you output a date, unless you specifically use UTC date methods, the date will be converted to the user’s local timezone regardless of how the date was created. For instance if you created a date in the Eastern timezone, the date/time will be converted to pacific time if that is where the user resides

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    jqxGrid date formating #55519

    emrealtan
    Participant

    Dear Peter,
    My data looks like this: “2014-06-06T15:47:25Z”. I think if I find a way to delete “Z” at the end of the data, problem can be solved. Have you any other suggestion?

    Emre

    jqxGrid date formating #55521

    emrealtan
    Participant

    Hi Peter,
    I found a method in my code that adds “Z” to end of the data when formatting DateTime values. I changed it, and problem solved.

    Thanks for help.

    Best Regards,
    Emre

    jqxGrid date formating #55522

    Peter Stoev
    Keymaster

    Hi Emre,

    As far as I see your Date String is in UTC format. When you output it, it would be in your Local Time Zone and that’s where the difference comes. One option is to use a more full format so your users would know in which time zone they see the date or you can display the time zone somewhere else on your app, but the Dates are correct. You can also try this: set the data field’s type property to “date” and format property to “yyyy-MM-dd HH:mm:ss”.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    jqxGrid date formating #80003

    jgarcias
    Participant

    Hi all

    I used to have the same problem that SkippingAdi (Adrian) had and I solved it by changing the way I retrieved the data from the database. Before I used to have something like:

    SELECT CONVERT(date, myDateColumn) FROM ...

    and with this approach jqxGrid used to show something like “Mon May 23 02:00:00 UTC+0200 1988” in my web application regardless of the format that I put in the field in both the source structure and grid column definition.
    So, I decided to change that statement for this one:

    SELECT CONVERT(varchar, myDateColumn, 105) FROM ...

    because I needed to show the date with the Italian format (dd-mm-yyyy).
    I did not need to make any calculation with that date, it was only an informational date for the user and that’s why I decided to retrieve my data in this way.

    Hope this helps someone else.

Viewing 6 posts - 16 through 21 (of 21 total)

You must be logged in to reply to this topic.