index-dd255780.js 666 B

12345678910111213141516
  1. function timestampToTime(timestamp, type) {
  2. if (type == "s") {
  3. timestamp = timestamp * 1e3;
  4. }
  5. let date = new Date(timestamp);
  6. let Y = date.getFullYear() + "-";
  7. let M = (date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1) + "-";
  8. let D = (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " ";
  9. let h = (date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":";
  10. let m = (date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) + ":";
  11. let s = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  12. return Y + M + D + h + m + s;
  13. }
  14. export {
  15. timestampToTime as t
  16. };