“Unix bisher in JavaScript” Code-Antworten

Unix -Zeit bisher JavaScript

const unixTime = 1210981217;
const date = new Date(unixTime*1000);
console.log(date.toLocaleDateString("en-US"));
//expected: "5/16/2008"
CharllierJr

JavaScript -Datum in UNIX konvertieren

new Date('2012.08.10').getTime() / 1000
feddynventor

Unix zur Zeit in JavaScript

const unixToTime = (string) => {
  const unix_timestamp = string;
  const date = new Date(unix_timestamp * 1000);
  const hours = date.getHours();
  const minutes = "0" + date.getMinutes();
  const seconds = "0" + date.getSeconds();
  const newText =
    hours + " : " + minutes.substr(-2) + " : " + seconds.substr(-2);
  
  return newText
};
mrmalik610

Unix bisher in JavaScript

const unixToDate = (string) => {
  const unixTime = string;
  const date = new Date(unixTime * 1000);
  const newText = date.toLocaleDateString("en-US");
  
  return newText
};
mrmalik610

Ähnliche Antworten wie “Unix bisher in JavaScript”

Fragen ähnlich wie “Unix bisher in JavaScript”

Weitere verwandte Antworten zu “Unix bisher in JavaScript” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen