1 Reply Latest reply on Mar 20, 2012 1:29 PM by DSwingley-esristaff

    SQLServer datetime field doesn't translate properly as javascript date object

    dcakins
      I am reading a date value directly from a sqlserver table and trying to display the value as text in an info wondiw using javascript api.  I can read the table, get the numeric value stored in the table, format the date into a useful string, and display the result.  My problem id the date is always one day behind what it read from the table.  Code snippet are:

                          var info = feature.attributes.desc
      .
      .
      .
                              + "<br />Report Date : " + formatDate(feature.attributes.reportDate);
                          var template = new esri.InfoTemplate("", info);


              function formatDate(value) {
                  if (value != null) {
                      var inputDate = new Date(value);
                      return dojo.date.locale.format(inputDate, {
                          selector: 'date',
                          datePattern: 'MM/dd/yyyy'
                      });
                  }
                  else {
                      return "null";
                  }
              }


      Has anyone else experienced this problem?  How can I fix this issue?