-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
114 lines (80 loc) · 2.43 KB
/
main.js
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
function YYYYMMDDhhmmss(){
var date = new Date();
var year = date.getFullYear().toString();
var month = date.getMonth() + 1;
month = month < 10 ? '0' + month.toString() : month.toString();
var day = date.getDate();
day = day < 10 ? '0' + day.toString() : day.toString();
var hour = date.getHours();
hour = hour < 10 ? '0' + hour.toString() : hour.toString();
var minites = date.getMinutes();
minites = minites < 10 ? '0' + minites.toString() : minites.toString();
var seconds = date.getSeconds();
seconds = seconds < 10 ? '0' + seconds.toString() : seconds.toString();
return year + month + day + hour + minites + seconds;
}
function YYYYMMDD(){
var date = new Date();
var year = date.getFullYear().toString();
var month = date.getMonth() + 1;
month = month < 10 ? '0' + month.toString() : month.toString();
var day = date.getDate();
day = day < 10 ? '0' + day.toString() : day.toString();
return year + month + day;
}
function hhmmss(){
var date = new Date();
var hour = date.getHours();
hour = hour < 10 ? '0' + hour.toString() : hour.toString();
var minites = date.getMinutes();
minites = minites < 10 ? '0' + minites.toString() : minites.toString();
var seconds = date.getSeconds();
seconds = seconds < 10 ? '0' + seconds.toString() : seconds.toString();
return hour + minites + seconds;
}
function YYYY(){
var date = new Date();
var year = date.getFullYear().toString();
return year;
}
function MM(){
var date = new Date();
var month = date.getMonth() + 1;
month = month < 10 ? '0' + month.toString() : month.toString();
return month;
}
function DD(){
var date = new Date();
var day = date.getDate();
day = day < 10 ? '0' + day.toString() : day.toString();
return day;
}
function hh(){
var date = new Date();
var hour = date.getHours();
hour = hour < 10 ? '0' + hour.toString() : hour.toString();
return hour;
}
function mm(){
var date = new Date();
var minites = date.getMinutes();
minites = minites < 10 ? '0' + minites.toString() : minites.toString();
return minites;
}
function ss(){
var date = new Date();
var seconds = date.getSeconds();
seconds = seconds < 10 ? '0' + seconds.toString() : seconds.toString();
return seconds;
}
module.exports = {
YYYYMMDDhhmmss,
YYYYMMDD,
hhmmss,
YYYY,
MM,
DD,
hh,
mm,
ss
}