Fork me on GitHub

Should there be any translation of dates or times going on when querying using I'm querying MS SQL Server, if I run the query outside of my Clojure program it returns 2018-04-16 21:44:36.000, but from my program I'm getting #inst"2018-04-17T03:44:36.000000000-00:00" I've got clj-time required in other parts of my program but not directly in that file, and I've also got honeysql required in my namespace but I'm not using it for this query. I'm assuming that there's something in my dependencies that is doing something weird, but since dates and times are so much fun I figured I would see if anyone has run into something like this in case I'm not thinking of something else.


if I recall, many jdbc drivers will assume dates in the database are in utc and try to translate them to the local timezone


so I would check what timezone the jvm thinks it is running in


(if the column type doesn't store a timezone)


@hiredman Thanks! I wouldn't have thought of looking at the JVM at all. I stored everything UTC but I want to get it back out as UTC too, so that is likely where things are going awry.


@shaun-mahood Best practice is to have all your servers (both database and application) set to UTC, and make sure the database is configured to UTC as well.


Timezones are just hell.

👍 8

The crappy thing is that I really do only need local time, but I have been using UTC because local time was such a pain in the butt last time I started a new project. Oh well.