calculate time zone or UTC

4630
12
12-19-2017 09:09 AM
JosephRogan2
New Contributor

Hello, I'm trying to calculate a custom string from a date and time using the now() function.  This gives my the local time, which is fine, kinda.  What I need to know is the timezone of this local time, or the zulu time.  I'm using the info found at:

https://community.esri.com/groups/survey123/blog/2016/04/17/dates-and-time-in-survey123-for-arcgis 

It would be great if there was a %timezone or something that returned the UTC offset but there isn't.  Is there any way to calculate this?  I'm wondering if it could be calculated out of a decimal date or something, but I'm limited to what I can use as a calculation in Survey123.

My goal is to write a military date-time group, EXAMPLE: 091630Z JUL 11 represents 1630 UTC on 9 July 2011.  There is more to my final formatting than that though, saving it as a date/time object won't help.

Thanks!

0 Kudos
12 Replies
AndrewHargreaves2
Occasional Contributor III

James Tedrick

I'm assuming there's no way to include 'utcOffset' within 'now()' ? I tried the below to no success:

now(pulldata("@property","utcOffset"))

Thanks

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Andrew,

The now() function takes no parameters - it simple returns the current timestamp.  If you are wanting to generate a 'local' timestamp (one with the UTC offset built-in to support systems that are not timezone aware), you would need to add the offset to the timestamp (in the calculation column):

now() + pulldata("@property", "utcoffset")*60*60*1000

JoeFlannery
Occasional Contributor III

James:

I was excited to see the time error bug fix in report generation in the August 30th update to Survey123 website.  I don't know if what I am reporting here is a bug or expected behavior.  

As shown in my earlier posting, above, I am using the "start" and "end" options in the "type" field to automatically get the start time and end time of the survey form.  I take those results and format them and save them as text.

I discovered that if the "type" field for my StartDTtext and StopDTtext items is "hidden", then my times are output in the S123 Word report incorrectly (see below).  If the "type" field for my StartDTtext and StopDTtext items is "text", then my times are output in the S123 Word report correctly (see below).  This is true even though my "bind::esri:fieldType = esriFieldTypeString".

Thank you for your time

Joe

time

0 Kudos