posted 15 years ago
The problem is that getTime() returns a Date, and the toString() method of Date always uses your computer's default time zone and format, i.e. local time. There's nothing wrong with getTime() returning a Date, that's fine - you just need to know that the toString() method will not handle time zones for you. Instead, you can do this with a DateFormat object, e.g.