timeFormatter.js 300 B

12345678
  1. export function timeFormat(timestamp) {
  2. const date = new Date(timestamp)
  3. const yy = date.getFullYear();
  4. const mm = (date.getMonth() + 1) < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
  5. const dd = date.getDate() < 10 ? "0" + date.getDate() : date.getDate()
  6. return `${yy}/${mm}/${dd}`
  7. }