| | |
| | | export function todayDate(arg){ |
| | | export function todayDate(arg) { |
| | | let date = new Date() |
| | | let year = date.getFullYear() |
| | | let month = date.getMonth() + 1; |
| | |
| | | let hour = date.getHours() |
| | | let minutes = date.getMinutes() |
| | | let seconds = date.getSeconds() |
| | | console.log(arg,'时间'); |
| | | if(arg == 'hms'){ |
| | | hour = hour < 10 ? '0' + hour : hour |
| | | minutes = minutes < 10 ? '0' + minutes : minutes |
| | | seconds = seconds < 10 ? '0' + seconds : seconds |
| | | return hour+':'+minutes+':' + seconds |
| | | hour = hour < 10 ? '0' + hour : hour |
| | | minutes = minutes < 10 ? '0' + minutes : minutes |
| | | seconds = seconds < 10 ? '0' + seconds : seconds |
| | | month = month < 10 ? '0' + month : month |
| | | day = day < 10 ? '0' + day : day |
| | | if (arg == 'hms') { |
| | | return hour + ':' + minutes + ':' + seconds |
| | | }else if(arg == 'ymd') { |
| | | return year + '-' + month + '-' + day |
| | | }if (arg == 'ymd hm') { |
| | | return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes |
| | | }else { |
| | | return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes + ':' + seconds |
| | | } |
| | | } |
| | | } |