# 时间格式化
# timeFormat
- timeFormat | date(timestamp, format = "YYYY-MM-DD")
 
<template>
    <div class="wrapper">
        <text>timeFormat: 格式化时间日期</text>
    </div>
</template>
<script>
export default {
    data:()=> ({
        name: 'timeFormat'
    }),
    methods: {
        trimHandler() {
            let time  = +new Date()
            //格式化日期时间
            let res = this.$util.timeFormat(time)
            this.$toast(res)
        }
    }
}
</script>
<style scoped>
.wrapper{
    background-color: #ffffff;
}
</style>
 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 参数
- 成功时返回
 
| Params | Type | Required | default | Value | 
|---|---|---|---|---|
dateTime |  Number |  N |  Number(new Date()) |  时间戳 | 
fmt |  String |  N |  YYYY-MM-DD |  自定义时间日期格式,如:YYYY-MM-DD hh:mm:ss …… |