1

I have a DATETIME field named "event_timestamp" in MySQL database that has the following value:

2014-07-23 12:31:00

When I query the database (I use SAILS, waterline ORM is used, specifically find() function), the result object shows the value shifted by "2 hours"

results.event_timestamp : Wed Jul 23 2014 14:31:00 GMT+0200 (EEST)

How can I handle this, I tried setting timezones in Mysql & Nodejs but to no avail.

Travis Webb
  • 14,688
  • 7
  • 55
  • 109
Bahaa
  • 105
  • 1
  • 1
  • 8

1 Answers1

3

It is not shifted by two hours, it is converted from a timestamp without a time zone to a timestamp with a time zone. When you store dates in a database, they are automatically saved in UTC time, so it is implied that your date

2014-07-23 12:31:00

is really

Wed Jul 23 2014 12:31:00 GMT+0000 (UTC)

When you query it using Waterline, it automatically gets converted to your local time zone format, giving you:

Wed Jul 23 2014 14:31:00 GMT+0200 (EEST)
Igor Zinov'yev
  • 3,676
  • 1
  • 33
  • 49