export function formatTime(number, format) {
  var formateArr = ['Y', 'M', 'D', 'h', 'm', 's']
  var returnArr = []

  var date = new Date(number * 1000)
  returnArr.push(date.getFullYear())
  returnArr.push(fillZeroPrefix(date.getMonth() + 1))
  returnArr.push(fillZeroPrefix(date.getDate()))

  returnArr.push(fillZeroPrefix(date.getHours()))
  returnArr.push(fillZeroPrefix(date.getMinutes()))
  returnArr.push(fillZeroPrefix(date.getSeconds()))

  for (var i in returnArr) {
    format = format.replace(formateArr[i], returnArr[i])
  }

  return format
}

function fillZeroPrefix(num) {
  return num < 10 ? '0' + num : num
}
