| 4 | |
| 5 | // get current date and time |
| 6 | let getDateTime = function () { |
| 7 | let currentTime = new Date(); |
| 8 | let month = currentTime.getMonth() + 1; |
| 9 | let day = currentTime.getDate(); |
| 10 | let year = currentTime.getFullYear(); |
| 11 | let hours = currentTime.getHours(); |
| 12 | let minutes = currentTime.getMinutes(); |
| 13 | let seconds = currentTime.getSeconds(); |
| 14 | |
| 15 | if (minutes < 10) minutes = "0" + minutes; |
| 16 | if (seconds < 10) seconds = '0' + seconds; |
| 17 | |
| 18 | return 'Y-m-d H:i:s'.replace('Y', year) |
| 19 | .replace('m', month) |
| 20 | .replace('d', day) |
| 21 | .replace('H', hours) |
| 22 | .replace('i', minutes) |
| 23 | .replace('s', seconds); |
| 24 | |
| 25 | }; |
| 26 | |
| 27 | // get ISO 8601 date and time |
| 28 | let getISODateTime = function (d) { |