Saving Date/Time to a Date type field

750
6
Jump to solution
09-21-2023 06:01 AM
BrianBulla
Occasional Contributor III

Hi,

So when saving to a "Date" type field, does it always convert the time to UTC, or does it just store the date/time as whatever is fed/typed in.

For example, in a VertiGIS Mobile application I am working on we are auto setting the Inspection Date field in a form with = Date.Now(), but when the form saves to the table in our SDE it seems to be saving 4 hours ahead.  So what should be 9/21/2023 @ 8:22AM actually shows up in the data as 9/21/2023 @ 12:22PM.

Can anyone explain what might be going on??

0 Kudos
1 Solution

Accepted Solutions
AyanPalit
Esri Regular Contributor

@BrianBulla Although I am not knowledgeable in VertiGIS Mobile application; the typical mobile app would work off a feature service. There are many configuration parameters at the feature service, one of them being Date/Time.

In the Publish Map Service pane, on the Configuration tab, click the Configure Parameters, under Date Fields, click the Time zone of the data drop-down arrow and choose the time zone in which your date values are stored. Specifying the time zone in which the dates are recorded allows date and time values to be converted correctly when users interact with the service.

You only need to choose a time zone if your map contains layers with date fields. If you don't specify a time zone, the dates are assumed to be stored in UTC.

Reference: Configure a map service

Ayan Palit | Principal Consultant Esri

View solution in original post

6 Replies
AlfredBaldenweck
MVP Regular Contributor

Sounds like a time zone thing; most of the time they save as UTC.

clt_cabq
Occasional Contributor III

my understanding is that most web based applications are going to default to using UTC unless you tell the app to do differently. Is +4 hours the UTC offset for where you are at? You may also have to consider Daylight Savings in this. I'm not familiar with VertiGIS, but you may want to reach out to their customer service or help to confirm how dates are calculated and if there are ways to force local time into your field.

BrianBulla
Occasional Contributor III

Hi.  We are in EST, which normally is -5, but maybe with daylight savings that is why it is at -4??  That whole topic of DST vs normal time is confusing enough!!  🙂

0 Kudos
AyanPalit
Esri Regular Contributor

@BrianBulla Although I am not knowledgeable in VertiGIS Mobile application; the typical mobile app would work off a feature service. There are many configuration parameters at the feature service, one of them being Date/Time.

In the Publish Map Service pane, on the Configuration tab, click the Configure Parameters, under Date Fields, click the Time zone of the data drop-down arrow and choose the time zone in which your date values are stored. Specifying the time zone in which the dates are recorded allows date and time values to be converted correctly when users interact with the service.

You only need to choose a time zone if your map contains layers with date fields. If you don't specify a time zone, the dates are assumed to be stored in UTC.

Reference: Configure a map service

Ayan Palit | Principal Consultant Esri
BrianBulla
Occasional Contributor III

Hi.  So updating the Time Zone on the webservice is now saving the proper date/time in to our table in SDE.  Thanks for the tip!!

BrianBulla
Occasional Contributor III

Thanks everyone.  I am working with the support at VertiGIS too, so hopefully I'll get this figured out soon.  Lots of options to look in to.

0 Kudos