0

I have my datetime SQL columns with all my data in UTC, for example:

2020-05-31 16:59:35

But when I extract it from my app with this query:

select expdate 
from tempbans 
where banid = '${tempVars("banid")}'    

I get this output:

Sun May 31 2020 18:59:35 GMT+0200 (GMT+02:00)

I know the local machine is on UTC+2 but I don't want it to auto-convert it for me, I want the output in my app to remain UTC.

What can I do?

Thanks.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
ManuGD
  • 1
  • 1

1 Answers1

0

It is not the node part but .js part behaving like this. Maybe you should try converting your output before print it.

var datee = new Date('2020-05-31 16:59:35');
console.log(datee.getFullYear() + '-' +('0' + (datee.getMonth()+1)).slice(-2)+ '-' +  ('0' + datee.getDate()).slice(-2) + ' '+datee.getHours()+ ':'+('0' + (datee.getMinutes())).slice(-2)+ ':'+datee.getSeconds());

jsfiddle

Extremely useful source : How to format a Date in MM/dd/yyyy HH:mm:ss format in JavaScript?

ismetguzelgun
  • 1,090
  • 8
  • 16