jQWidgets Forums

jQuery UI Widgets Forums Editors DateTimeInput Days are off by 1

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 10 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Days are off by 1 #62602

    smithgr@jhmi.edu
    Participant

    I’m pulling data from a mysql db. Using the DateTimeInput each day is 1 day off.

    For example 2011-12-27 displays as 2011-12-26.

    My code looks like:
    $(“#analysisStart”).jqxDateTimeInput({ width: ‘200px’, height: ’25px’, formatString: ‘d’});

    <tr><td>Analysis Start</td><td><div name=”analysisStart” id=”analysisStart” value=”<?php echo $row[‘analysis_start’]; ?>”></div></td></tr>

    If I just display the value with an echo they are correct.

    Thanks.

    Days are off by 1 #62641

    Peter Stoev
    Keymaster

    Hi smithgr,

    My suggestion for you is to read about the JavaScript Date object and how it works with different Time Zones. jqxDateTimeInput works with JavaScript Date object. When you pass to it a value like “2011-12-27”, it will create a date using var date = new Date(“2011-12-27”) so either pass a Full String which includes Time Zone Information or create the JavaScript Date object on your own and then set it as value of the widget through its “val” or “setDate” methods.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.