I have an Oracle database, in which I have timestamp fields but am not storing the timezone.
A global JSF application we have developed being used across UK, US and Sweden - we agreed that we would save dates with server time, and present dates with server time.
I am creating date stamps simply using new Date() in the managed bean and then storing these in Oracle.
I have a date in Oracle:
21-AUG-13 12.24.13.125000000
I want this date to be presented in JSF. We know it is server time which is UTC+2.
JSF and Primefaces are presenting this as:
21/08/2013 11:24
So seem to be subtracting one hour.
I shelled into the linux instance running tomcat, and "date" gives me:
Thu Sep 19 16:25:45 CEST 2013
And doing a System.out.println for a new Date() instance, I get:
Thu Sep 19 15:25:45
I would have assumed creating a Date() instance in the managed bean would use the date on the linux server hosting tomcat, but is one hour behind...
I know Dates have no timezone component but are assuming UTC....
So I am probably reading back a date which is actually UTC+2 into a date instance, which assumes this is UTC+0...and then somehow JSF, seeing the server is operating at UTC+2, is subtracting 2 hours off to get me back to UTC!!
Any advice on where this is falling down, and why new Date() doesnt match the linux date shell value would be appreciated.
Regards
i