Answers for "timestamp to yyyy/mm/dd in js"

2

javascript format date yyyy-mm-dd

// yyyy-mm-dd
new Date().toISOString().slice(0, 10)
Posted by: Guest on March-29-2021
0

unix timestamp to date javascript yyyy-mm-dd

function timeConverter(UNIX_timestamp){
  var a = new Date(UNIX_timestamp * 1000);
  var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
  var year = a.getFullYear();
  var month = months[a.getMonth()];
  var date = a.getDate();
  var hour = a.getHours();
  var min = a.getMinutes();
  var sec = a.getSeconds();
  var time = date + ' ' + month + ' ' + year + ' ' + hour + ':' + min + ':' + sec ;
  return time;
}
Posted by: Guest on September-26-2020

Code answers related to "timestamp to yyyy/mm/dd in js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language