Select to view content in your preferred language

Format-date function

583
2
Jump to solution
07-07-2022 10:15 AM
BKS
by
Frequent Contributor

I'm using the format-date function to extract the various elements of date and time as follows but I cannot get the last element (0 padded seconds) to be anything other than 00 (i.e. '%S' below).

string(format-date(${dc_date},'%y'))
+ string(format-date(${dc_date},'%m'))
+ string(format-date(${dc_date},'%d'))
+ string(format-date(${dc_date},'%H'))
+ string(format-date(${dc_date},'%M'))
+ string(format-date(${dc_date},'%S'))

dc_date is defined as a datetime field with a default value of now() and bind::esri:fieldType to esriFieldTypeDate.

s_id is defined as a text field with the calculation set to the format-date function above  and bind::esri:fieldType to esriFieldTypeString

I've tried changing the fieldTypes but this didn't have any impact.

Survey form spreadsheet with these two records is attached.

Anyone else with this issue / solution?

 

The result of the format-date calculation is as follows with the 00 at the end for seconds every time: 220707131700

0 Kudos
1 Solution

Accepted Solutions
AndyMcClary
Regular Contributor

Survey123 doesn't store time to the precision of seconds in the datetime field so string(format-date(${dc_date},'%S')) will always just return 00. I asked the about this at the developers conference and apparently it's intended behavior and there are no plans to change it. 

View solution in original post

2 Replies
AndyMcClary
Regular Contributor

Survey123 doesn't store time to the precision of seconds in the datetime field so string(format-date(${dc_date},'%S')) will always just return 00. I asked the about this at the developers conference and apparently it's intended behavior and there are no plans to change it. 

BKSchwarz
Occasional Contributor

Hi Andy,

Thanks for relaying that info.  

Kind of frustrating that ESRI would say it is "intended" behaviour when they document it otherwise.

https://doc.arcgis.com/en/survey123/desktop/create-surveys/xlsformformulas.htm#ESRI_SECTION2_AF58C02...

Again, thx for the info.

0 Kudos