From aff9439ba32e05dd1ee82a86525638fc7acc3413 Mon Sep 17 00:00:00 2001 From: Aggelos Vogiatzis Date: Wed, 11 Aug 2021 13:55:07 +0300 Subject: [PATCH] Fixed and changed Date saving on DB --- src/backend.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend.js b/src/backend.js index 9fd7fde..c30fc52 100644 --- a/src/backend.js +++ b/src/backend.js @@ -605,7 +605,7 @@ function checkForTable(event) { function sendDatatoDB(values) { if (toggleInsert) { - let now = new Date(); + let date = new Date(); // console.log(values); db('values').insert( { @@ -647,7 +647,8 @@ function sendDatatoDB(values) { SUNENERGY: values.SUNENERGY, SUNENERGYG1: values.SUNENERGYG1, SUNENERGYG2: values.SUNENERGYG2, - DATE: now.format("dd/MM/yyyy HH:mm:ss l"), + DATE: date.getDate() + '/' + (date.getMonth() + 1) + '/' + date.getFullYear(), + TIME: date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds() + '-' + date.getMilliseconds(), } ).then(() => console.log('Inserted')) .catch((err) => { console.log(err); throw err; });