| Member with 2 posts. THREAD STARTER | | Join Date: Jul 2012 Experience: Advanced | |
Windows 7 and Java getTime function I am running on Windows 7 Professional, Service Pack 1, 64 bit. I am also using Java 1.4.02_08 (old but serviceable for our purposes).
When I run my code on XP, the variable todayTime using the Java getTime() function returns the correct local time - namely the time which shows on my computer clock which is GMT-06 (Central time USA).
I recently upgraded to Windows 7 and running the same code, the variable todayTime using the Java getTime() function returns GMT time not the local time shown on the computer. I have looked at the computer clock during restart and the BIOS shows the correct local time.
My question - what do I need to do to get the Java function to work with Windows 7?
Here's the code snippet:
Calendar today = Calendar.getInstance();
SimpleDateFormat dateformat = new SimpleDateFormat("MM/dd/yyyy");
String defaultDate = dateformat.format(today.getTime());
SimpleDateFormat timeformat = new SimpleDateFormat("hh:mm a");
java.util.Date todayTime = today.getTime();
String defaultTime = timeformat.format(todayTime);
Thanks in advance. |