Java and datetime
Posted on 2011-04-29
Having an unusual probem with dates on a windows 7 laptop. Say if i run the below code in eclipse (for java 1.4 and/or java 1.6) I get the following printed on the console "Fri Apr 29 11:12:34 BST 2011" which is correct as the time being shown on the pc is "Fri Apr 29 11:12:34 BST 2011".
However when I run this as a standalone application (which runs inside a window service) on the same pc I get the following "Fri Apr 29 10:12:34 BST 2011".
Any ideas on what im doing wrong?
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+00"));
Date date = cal.getTime();