Thursday, 25 May 2017

node js automatically convert GMT format date in MySQL to local format while querying records

In my node app, I have MySQL DB which has a column named xxx_date in GMT date format. I am querying the date field from DB using Node JS. The resulted data is in my local time format. I want the same data(in GMT). And I tried with changing my query with CONVERT_TZ method also. but the resulted data is mismatching. Someone suggest a right way do this.

for example

 xxx_date in DB: 2017-05-22 08:14:00
 the date I get after querying from DB: 2017-05-22T02:44:00.000Z
 but it should be either: 1:45 PM Monday, May 22, 2017, or  2017-05-22 08:14:00

what's happening behind this?



via Sami

No comments:

Post a Comment