This week's book giveaways are in the Refactoring and Agile forums. We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line! See this thread and this one for details.
I've developed an application that simply pulls records from the DB out, and allows the user to select the date/time range to choose from (along with a bunch of other criteria). This has worked really well up till recently when the DB server (SQL Server 2005) was physically changed to one in another location.
Below is the criteria I'm using:
(I'm not using 'between' as either end of the limit is optional)
I've also been able to run SQL queries like this:
(for March 4th)
When we moved to the new DB server I found the application stopped returning correct results.
I'm no expert here, but I'm guessing the locale of the new server is different, and I've needed to specify the month and day switched around
(for March 4th)
I've confirmed that this is returning March 4th by doing a CONVERT on created_datetime on the returned results.
I would've thought that Hibernate would've been able to abstract me from this change. However, I confirmed that by turning on show_sql that:
This would mean "2011-03-04 xx:xx:xx" is being used in the SQL to the new DB server, which means April 3rd to the DB server instead of March 4th (imagine the irony - we changed the server yesterday, March 3rd, so this didn't show up!!)
Is there a way for Hibernate to use a 'standard' format? I can confirm that if I was able to send something like "2011-03-04T23:59:59" then both servers will interpret this as March 4th.