时间格式化方法
Showing
1 changed file
with
6 additions
and
2 deletions
... | @@ -111,14 +111,18 @@ export function down (index, data) { | ... | @@ -111,14 +111,18 @@ export function down (index, data) { |
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
114 | export function timeFormat(date) { | 114 | export function timeFormat(date,end) { |
115 | if (!date || typeof(date) === "string") { | 115 | if (!date || typeof(date) === "string") { |
116 | this.error("参数异常,请检查..."); | 116 | this.error("参数异常,请检查..."); |
117 | } | 117 | } |
118 | var y = date.getFullYear(); //年 | 118 | var y = date.getFullYear(); //年 |
119 | var m = date.getMonth() + 1; //月 | 119 | var m = date.getMonth() + 1; //月 |
120 | var d = date.getDate(); //日 | 120 | var d = date.getDate(); //日 |
121 | return y + "/" + m + "/" + d + ' 00:00:00'; | 121 | if (end) { |
122 | return y + "/" + m + "/" + d + ' 23:59:59'; | ||
123 | }else{ | ||
124 | return y + "/" + m + "/" + d + ' 00:00:00'; | ||
125 | } | ||
122 | } | 126 | } |
123 | export function getFirstDayOfSeason (d) { | 127 | export function getFirstDayOfSeason (d) { |
124 | let date = d || new Date() | 128 | let date = d || new Date() | ... | ... |
-
Please register or sign in to post a comment