Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
IgDatePicker - selecting value from datepicker in javascript outputs the datetime in browser timezone


generated code for Igdatepicker is below

<div class="ui-igeditor-input-container ui-corner-all"><input type="text" class="ui-igedit-input hasDatepicker" id="DatesScheduledShipDateValueEditingInput" role="combobox" aria-label="Date Picker" style='height: 100%; text-align: left;'><input type='hidden' name='DatesScheduledShipDateValue' value='2015-09-07T18:30:00.000Z' data-rule-required='true' data-msg-required='Value must be specified.' data-valtype='igDatePicker'></div>

if i try to get the value in javascript gives me below value

Tue Sep 08 2015 00:00:00 GMT+0530 (India Standard Time)

but i need the value in UTC.. how can i select this(the value which is associated with the generated HTMl is value="2015-09-07T18:30:00.000Z")

pcan anyone help me on this



  • 4315
    Offline posted

    Hi, Shwetha.

    I hope that I will be able to help you with my answer.

    If you set the option displayTimeOffset to 0 then display value will be UTC, no matter what is browser time:

       value: "2015-09-07T18:30:00.000Z",
       dateInputFormat: "dateTime",
       displayTimeOffset: 0

    As far as about the value method, we have designed the date editor to return always the value the browser is using - the one that it is automatically reverted. So you it is normal to see it that way. In order to get the UTC time just use the JavaScript methods to get UTC date - like for the hours - getUTCHours.

    var browserDate = $("#DatesScheduledShipDateValue").igDatePicker('value');

    var UTCHours = browserDate.getUTCHours().

    If you have further questions, don't hesitate to ask!

    Best regards,

    Nikolay Alipiev

    Software Developer

Reply Children
No Data