Select to view content in your preferred language

Build a unique ID using now()?

1760
3
05-10-2018 12:39 PM
EdApalinski
Regular Contributor

Hi,

I would like to build an ID number based on the date and time as shown below:

YYYYMMDDHrHrMnMn

Y=Year, M=Month, D=Day, Hr=Hour, Mn=Min

I am trying the now() function in the calculation column where I get a number reported as a value (see image) which .  Does anyone know how to interpret this value so I can convert it to my format?

Or does anyone know another way to create such an ID in the xls form?

Thanks for any help and or ideas!

Ed

0 Kudos
3 Replies
JamesTedrick
Esri Esteemed Contributor

Hi Edward,

Date and time are internally stored as 'epoch time' - the number of milliseconds from 1 Jan. 1970.  To create a human-readable time, you need to use the format-date() function - look for the 'Date Formatting' section in Formulas—Survey123 for ArcGIS | ArcGIS .  Also, Dates and Time in Survey123 for ArcGIS and Creating 'Ticket Numbers' in Survey123 for ArcGIS may be helpful blog articles.

EdApalinski
Regular Contributor

James,

Thanks!  found exactly what I needed in the Creating Ticket Numbers blog.  If anyone else is interested I used: format-date(now(), '%y%m%d%H%M%S') in the calculation field to get the auto-populated ID.

Cheers!

Ed

AnkiGuna
New Contributor

This is working fine when I create survey 1st time. But I want to keep that same unique id during edit also. And if user is performing copy action at that time this unique id needs to be regenerated. Would you please guide me how can I achieve this requirement?

0 Kudos