Hi there,
I hope that you can help me -- this isn't exactly a
java question.
We have a java application written by contractors that stores the timestamp for various activities in our MS SQL database in java's long format.
I have a sql stored procedure that is supposed to take that long and convert it into a sql datetime. However, there is something wrong with the stored procedure, as it converts it into Pacific Standard Time or Pacific Daylight Savings Time depending on which time we are on CURRENTLY, rather than what time it was when the data was actually stored.
So, for example, I have a java date of 1280264615065. Right now, when I run my SQL proc it tells me that converts to 2010-07-27 13:03:35.067 -- but I know it actually was 14:03 on that day. If I was to wait for the time change and run the proc again, I would get the correct result.... but anything that occurred today would now be converted incorrectly.
This is the sql code:
My guess is that the offset is wrong and I need to determine the correct offset to use by first inspecting @ljd and deciding whether that occurred during Daylight Savings Time or not. Or, by going through the conversion, then checking the outcome, and then adding or subtracting an hour to the result. But both seem to be bad solutions....
Any ideas? Should I go away and ask this in a sql forum instead?
Thanks for any help you can provide.
Beverley