Converting Unix Time to Other Formats
Some systems use a time stamp that is commonly referred to by one of the following names:
- Unix time
- Unit timestamp
- POSIX time
The time is the number of milliseconds from 1 January 1970 12:00:00 UTC. For example, 1498683392 is the 28th of June, 2017, which is the date this post is authored.
To convert the value to a common format, create variables for the Unix time and the formatted value, and then use a Date Format procedure to convert it to the format you want to use:
- Create a variable and set it to the Unix time value. The example names this variable UnixTime.
- Create a second variable that you set in the procedure to the formatted time. The example names this variable MonthDayYear, because it uses that format.
- Create a procedure and use the variable that contains the Unix time:
- Add a Date Format action to the procedure. This example uses Long date format. Numerous formats are available.
- Add a Set Variable action and set the variable MonthDayYear.
- Verify the values in the Variables window.
- Save your changes.
Download the sample project, TimeSample.efz, to see a project that uses the procedure described in this post. Just unzip the file, start the eFORMz Composer, and open TimeSample.efz.