fork download
  1. process.stdin.resume();
  2. process.stdin.setEncoding('utf8');
  3.  
  4. // your code goes here
  5.  
  6. let unix_timestamp = 1582146000
  7. // Create a new JavaScript Date object based on the timestamp
  8. // multiplied by 1000 so that the argument is in milliseconds, not seconds.
  9. var date = new Date(unix_timestamp * 1000);
  10. // Hours part from the timestamp
  11. var hours = date.getHours();
  12. // Minutes part from the timestamp
  13. var minutes = "0" + date.getMinutes();
  14. // Seconds part from the timestamp
  15. var seconds = "0" + date.getSeconds();
  16.  
  17. // Will display time in 10:30:23 format
  18. var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);
  19.  
  20. console.log(formattedTime);
  21.  
  22. console.log(date.getDay());
  23.  
Success #stdin #stdout 0.07s 30648KB
stdin
Standard input is empty
stdout
21:00:00
3