Disable TimeZone


#1

When I get dates from the database, javascript automatically converts.
For example, if in database is 18:00:00, on screen shows 15:00:00 , cause im GMT -3.

How can i disable it ??


#2

That’s because there’s no clock time stored in the database. Dates are stored as Unix time and are decoded based on your time zone. The getTime() method will display them as UTC by default.

Alternatively, Moment.js has some notable improvements over vanilla JS when it comes to manipulating dates, and there’s a specific library for dealing with time zones.