Form Expression with date in Survey 123

722
2
Jump to solution
03-11-2021 04:30 PM
RachelBu
New Contributor II

I'm trying convert the dateTime value of a previous question to Time of Day(24-hour) to the next question. For example, if a user enters 3/11/2021 4:15 PM, I want to calculate it to be 16:15 and be read only for answer of the next question. I know that the readonly and calculation columns exist in the XLS form. I just want to know what kind of expression is needed to perform the date time convertion.

 

Thanks!

0 Kudos
1 Solution

Accepted Solutions
Jim-Moore
Esri Regular Contributor

Hi @RachelBu 

If you just want to store the 24-hour time as a string, use the format-date() function. For example:

format-date(${datetime},'%H:%M')

Jim-Moore_0-1615769951867.png

For more examples and useful info, please see this great blog post all about dates and time in Survey123.

Hope this helps! Best, Jim

View solution in original post

2 Replies
Jim-Moore
Esri Regular Contributor

Hi @RachelBu 

If you just want to store the 24-hour time as a string, use the format-date() function. For example:

format-date(${datetime},'%H:%M')

Jim-Moore_0-1615769951867.png

For more examples and useful info, please see this great blog post all about dates and time in Survey123.

Hope this helps! Best, Jim

RachelBu
New Contributor II

Thanks!

0 Kudos