|
@@ -79,3 +79,29 @@ export function dateToString (date) {
|
|
|
}
|
|
|
return year + '-' + month + '-' + day
|
|
|
}
|
|
|
+
|
|
|
+export function dateTimeToString (date) {
|
|
|
+ let date1 = new Date(date)
|
|
|
+ const year = date1.getFullYear() + ''
|
|
|
+ let month = (date1.getMonth() + 1) + ''
|
|
|
+ let day = (date1.getDate()) + ''
|
|
|
+ let h = date1.getHours() + ''
|
|
|
+ let m = date1.getMinutes() + ''
|
|
|
+ let s = date1.getSeconds() + ''
|
|
|
+ if (month.length === 1) {
|
|
|
+ month = '0' + month
|
|
|
+ }
|
|
|
+ if (day.length === 1) {
|
|
|
+ day = '0' + day
|
|
|
+ }
|
|
|
+ if (h.length === 1) {
|
|
|
+ h = '0' + h
|
|
|
+ }
|
|
|
+ if (m.length === 1) {
|
|
|
+ m = '0' + m
|
|
|
+ }
|
|
|
+ if (s.length === 1) {
|
|
|
+ s = '0' + s
|
|
|
+ }
|
|
|
+ return year + '-' + month + '-' + day + ' ' + h + ':' + m + ':' + s
|
|
|
+}
|