setting the timezone

655 views
Skip to first unread message

Randall Meeker

unread,
Aug 13, 2014, 10:45:29 PM8/13/14
to sai...@googlegroups.com
My local dev machine (that I'm running sails on) is in central time zone. But I want to develop my sails app as if it were running in UTC / +00:00.
I'm running MySql with Sails. I have MySql server set as UTC at the default, and when I query the DB directly i get my correct date / time (in UTC). 

However when sails queries the DB, sails / waterlines attempts to transform it into UTC (but it already is). so my UTC value of 
"2008-07-06 00:30:00" is transformed into "2008-07-06 05:30:00"


When I set my system timezone on my machine to UTC, then sails output all the data correctly. But then I have to work off of a machine in the wrong timezone.

So how to I set this up so it will work correctly?

I have looked at these issues to no avail:

and I have also read where your supposed to put this somewhere -- process.env.TZ = 'UTC'



Randall Meeker

unread,
Aug 14, 2014, 12:25:56 PM8/14/14
to sai...@googlegroups.com
Ok, I found a setting in the MySql options file to change timezone to UTC, its default is local.

This can be set in the connections.js 

  mySqlDb: {
    adapter : 'sails-mysql',
    host    : 'localhost',
    user    : 'xxxx',
    password: 'xxxx',
    database: 'xxxxx', 
    schema: true,
    timezone: 'utc'
  },
Reply all
Reply to author
Forward
0 new messages