This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
try { System.out.println("dateString is: " + dateString);
//Date resultDate1 = eptDateFormat.parse(dateString); //System.out.println("resultDate1 is: " + resultDate1);
Date resultDate2 = gmtDateFormat.parse(dateString); System.out.println("resultDate2 is: " + resultDate2);
} catch (Exception e) {
}
} }
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35253
7
posted
0
I tried this and it did not work:
What does this mean? What output did you get?
} catch (Exception e) {
}
It's almost never a good idea to ignore exceptions you're catching without at least generating a message that an exception was thrown - especially when working on a program that does not (yet) work correctly. [ August 22, 2005: Message edited by: Ulf Dittmer ]
dateString is: 9/1/2005 resultDate2 is: Wed Aug 31 20:00:00 EDT 2005
I expected resultDate2 to be: Thu Sep 1 04:00:00 GMT 2005
Rick O'Shay
Ranch Hand
Joined: Sep 19, 2004
Posts: 531
posted
0
There's a lot going on there but let's get to the core issue. Regardless of what value you have in resultDate2, if you are getting EDT then the system's using EDT not GMT.
>> System.out.println("resultDate2 is: " + resultDate2);
The key here is that Date values are effectively absolute. They never carry timezone or formatting information. Try a simple one-line program that prints the date.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.