Posted on

Power Apps – Create an Integer Time Stamp

There may be many reasons you might need to generate a unique identifier or time stamp in your power apps. Some examples include:

  1. To track user activity: Unique identifiers allow you to track and monitor user activity, including login information, form submissions, and other interactions.
  2. To create custom reports: Unique identifiers enable you to generate custom reports, analyze user data, and easily identify trends and correlations.
  3. To store user information: Unique identifiers are the perfect way to store user information, such as names, addresses, contact numbers, and more.
  4. To improve data accuracy: Unique identifiers help to ensure that data is accurate and up-to-date.
  5. To identify records: Unique identifiers make it easy to quickly identify and locate records in a database.
  6. To secure data: Unique identifiers can be used to secure data and prevent unauthorized access.
  7. To trace an event through a multi step automated process such as a flow, web service, or database.

So, if you are looking to create a unique ID and/or timestamp in Power Apps, then following code should help you out!

This code uses the Today(), Now(), and Text() functions in Power Apps to create a unique ID string based on the current date and time, and pads with leading zeroes. To use it, simply copy and paste it into your Power Apps app and assign it to a variable, replacing ‘varID’ with your own chosen variable name.

Set(varID,Concatenate(Text(Today(),"yyyymmdd"),Text(Hour(Now()),"00"),Text(Minute(Now()),"00"),Text(Second(Now()),"00") ));

The resulting ID string will look something like this: 20230216215633, where the first 8 characters are the current date (yyyymmdd) and the last 6 characters are the current time (hhmmss).

We hope this code helps you create a unique ID and timestamp in Power Apps!