How can I convert an epoch date to a human-readable format?

0 votes
asked Aug 12, 2022 by jon-t-7005 (6,410 points)
I have a UNIX epoch date, such as 1650550779577, and I want to convert that to a human-readable format.  How can this be accomplished?

1 Answer

0 votes
To convert from epoch to something human readable, you can use the Javascript Date function, like this:

var convertedDate = new Date('1650550779577' * 1000);

If you output the convertedDate variable, you'll get something like this: Fri Nov 14 54273 15:39:37 GMT-0800 (PST)

You can then use qie.formatDate() to change it to whatever format you want, like this:

var formattedDate = qie.formatDate('yyyy-MM-dd HH:mm', convertedDate);
answered Aug 12, 2022 by jon-t-7005 (6,410 points)