I have a unix time
and need to get a Date
object from it.
This code just transform the timestamp to human readable way:
var date = new Date(unix_timestamp*1000);
var hours = date.getHours();
var minutes = date.getMinutes();
var seconds = date.getSeconds();
var formattedTime = hours + ':' + minutes + ':' + seconds;
As a result I get 13:44:6
, for instance
but how I can create a Date
object with time and date from it?