formate.js 679 Bytes
function formateday() {
  let date = new Date()
  let str = ''
  let year = date.getFullYear()
  let month = date.getMonth()+1<10? "0"+ (date.getMonth()+1) : date.getMonth()+1
  let day = date.getDate()<10 ? "0"+date.getDate() : date.getDate
  str = year +"-"+ month +"-"+ day
  return str
}
function formateTime() {
  let date = new Date()
  let str = ''
  let hours = date.getHours()<10? "0"+date.getHours() : date.getHours()
  let minutes=date.getMinutes()<10 ? "0"+date.getMinutes() : date.getMinutes();
  let seconds=date.getSeconds()<10 ? "0"+date.getSeconds() : date.getSeconds();

  str = hours+":"+minutes+":"+seconds
  return str
}

export  { formateday, formateTime }