MCPcopy Create free account
hub / github.com/UncAnnyZ/MiniProgram-HotUpdate / formatTime

Function formatTime

utils/util.js:1–10  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1const formatTime = date => {
2 const year = date.getFullYear()
3 const month = date.getMonth() + 1
4 const day = date.getDate()
5 const hour = date.getHours()
6 const minute = date.getMinutes()
7 const second = date.getSeconds()
8
9 return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
10}
11
12const formatNumber = n => {
13 n = n.toString()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected