It appears that by default Rails creates it's timestamps in Postgres using timestamps without time zone information. This means that if you're working directly with the database, using psql for example, and want to see local time representations you'll have to do something like this.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
users.fname, | |
users.lname, | |
TIMEZONE('UTC', users.created_at) AT TIME ZONE 'CST6CDT' | |
FROM | |
users; |
1 comment:
After spending a good hour trying to figure this out, I finally found this post. Just wanted to +1 this.
Post a Comment