Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

unix to time 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
};
Source by www.textbotonline.com #
 
PREVIOUS NEXT
Tagged: #unix #time #javascript
ADD COMMENT
Topic
Name
4+7 =