DbDateUtils.fromSqlDate() returning yesterday


DbDateUtils.fromSqlDate(new Date(2005 - 1900, 11 - 1, 12)) returns 2005-11-11 thus test fails. See below.

test_fromSqlDate(com.opengamma.util.db.DbDateUtilsTest) Time elapsed: 0.211 sec <<< FAILURE!
java.lang.AssertionError: expected:<2005-11-12> but was:<2005-11-11>

Due to this failure I could not build.
Anyone knows how to fix?

I am using IntelliJ on Mac OS X 10.8.5

Thanks in advance.


Sounds like it might be a time zone issue. What time zone are you in?


I’m in Sydney Australia, +10


I’ve assigned it to one of our engineers, Stephen Colebourne, as JIRA issue PLAT-5536. He’s back from vacation on Wednesday so should be able to chase it up around then.

As a workaround you can skip the tests using:

mvn -DskipTests=true


Thanks heaps


See https://github.com/OpenGamma/OG-Platform/commit/ac2ddfd962154918be195a97bf3193385da82cce


I ran into this problem in HK. The trouble is that when you have a raw date, Java sets it to local midnight, which causes a problem because local midnight in Asia is not the same date as in London.

The workaround I put in was

Although the one that got checked in may be better.