Unix Time Conversion Function
Dec 5, 2022 | Code, JavaScript, snippet, FeaturedThis function takes in a unix timestamp as an argument and returns the time in HH:MM:SS format.
Because Unix times are recorded in seconds, we need to multiply by 1000 to get the number of milliseconds. Milliseconds are used for JavaScript Datetimes.
Finally, we simply use JavaScript's Date method toLocaleTimeString();
and pass in the en-US
locales.
You may find information about acceptable locales and options at Mozilla.