Build a unique ID using now()?

744
2
05-10-2018 12:39 PM
Occasional 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

Reply
0 Kudos
2 Replies
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.

Occasional 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