How to convert unix timestamps to human-readable date?
Hi,
Does any one know how to convert Unix timestamps to human-readable date?
Example Unix timestamp: 1568732257 --> wanted format: 2021-09-17 14:57:37 (Year-Month-Date Hour:Min:Sec)
Best Answer
-
this will also work
1
Answers
-
Hi @Eekki I would be interested to see what one of the smart people in the community come up with for this one. For those who aren't aware, the Unix timestamp in its raw format is based on elapsed seconds since Jan 1 1970. there is a handy converter to be found here : Unix Time Stamp - Epoch Converter. My initial thoughts are that there may be a way to easily do this using a regex, alternatively a calculation using the divisors.
C
1 -
@Eekki just purely based on the description that the "The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970" (wikipedia), the following functions could work.
2 -
Thank you both for your quick answers. I appreciate your answers.
1 -
@Eekki to get you even closer to your desired result, consider also using a variable, parsing the resulting date elements and concatenating them
0