snipplets.dev/~/JavaScript/timestamp_to_date.js

7 lines
296 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
Необходимо timestamp умножить на 1000, поскольку JavaScript отсчитывает время
с момента epoch (который равен 01/01/1970) в миллисекундах, а не в секундах.
*/
let date = new Date(timestamp * 1000);