1

I'm creating a web map that is updated a few times a day showing voltage readings from meters on our distribution network.

This layer has a field called ReadTime, and the data type is Date.

The date is formatted as: 0/00/0000 00:00:00 AM

So, I'm using the shortDateLongTime format as shown here.

However, when I click on a meter the date comes in fine, but the time is wrong. For example, a value for one of the meters in the attribute table from ArcMap is 6/17/2015 8:00:14 AM, but in the web map it's displaying as 6/17/2015, 1:00:14 AM.

I'm assuming I'm missing a setting somewhere, but I haven't been able to find out where.

var popupTemplate = new PopupTemplate({
        title: "{VoltageReadings_LOCATION}",
        fieldInfos: [{
            fieldName: "VoltageReadings_READ_TIME",
            visible: true,
            label: "Read Time",
            format: {
                dateFormat: 'shortDateLongTime'
            }
        }],
        showAttachments: true
    });

Update to show what worked:

var popupTemplate = new PopupTemplate({
        title: "{VoltageReadings_LOCATION}",
        fieldInfos: [{
            fieldName: "VoltageReadings_READ_TIME",
            visible: true,
            label: "Read Time",
            format: {
                dateFormat: 'shortDateLongTime'
            }
        }],
        showAttachments: true
    }, {
        utcOffset: 0
    });
2

It looks like your time wasn't stored in UTC and is getting converted improperly.

The PopupTemplate constructor has an option to set the UTC offset. Take a look at this discussion on the ArcGIS forum for a example on how to use it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.