So, I have an XML file that I use with dbUnit as a data source, and it has several dates in it. The date in the file looks like this: "2010-02-04", but as soon as it is downloaded, and I get access to it for printing or comparing tests, she believes that the date is "2010-02-03 23:00".
I assume this is due to EDT / EST, but I'm not sure how I can get dbUnit (or maybe sleep mode?) To use the correct time zone.
Does anyone have any experience with dbUnit and dates?
Thanks Peter
EDIT
Well, I'm sure, for some reason, it reads the date in EDT format, which is correct, and then saves it as EST, which is not technically correct (we are EDT here), but true for my computer that says this EST . This conversion causes the date to "lose" an hour. Not sure why Java thinks we are EST (Windows XP knows this is not the case), and I'm not sure why dbUnit thinks the date should be EDT, since it, like Java, probably should read the wrong time belt like est. This is pretty confusing.
EDIT
I took the XML version of Hibernate because it is not a problem. After you still get bored, this is what happens: 1. dbUnit reads the date as a string from the source XML and converts it to java.sql.Date. By nature, they do not store hours / minutes / seconds, but when you look at millions, it is clearly adjusted for 4 hours to show that although at midnight here in EDT it is 4 hours in UTC. In addition, it is supported by a calendar that has a time zone that is designated as "America / New York" or something similar. I do not remember exactly. 2. Whenever I print this date, my system, which thinks that EST transfers 4 AM UTC at 11 PM the previous day, would be correct, except that we are not in EST. 3. Whenever I create a date for testing as an example, since my JVM assumesthat we are in est, she addsfive hours in milliseconds to make the difference between it and UTC. Clearly, these are different “dates,” and this fails.
So, the real question, twice, I think: 1. Why does my console think it's EST? As far as I know, my Windows XP settings are correct. I understand that there was a problem with the wrong TZ in Java 1.4, but I think it was fixed and I am running (presumably) 1.6. 2. Why dbUnit residing in the same JVM using a suitable TZ.
I believe that I could stop using dates together, but I don't have that luxury.