prince davies wrote:
I have a date object , this can be associated with any time zone. How do I convert this date object into a date object which has time zone GMT. The input and output object should be date object.
Date objects don't have a TZ. They just represent an instant in time, and that instant is the same instant no matter what TZ you happen to be in.
Please do not convert and return a string object. thats not I wanted. I wanted a date object with gmt time zone or remove the time zone portion.
Since Dates don't have a TZ, and since TZ is purely a display issue, using a DateFormat to generate a String is the correct answer. If that doesn't meet your needs, then either you don't understand how
Java's date/time classes work, and you need to study up, or else you need to explain what you're actually trying to accomplish and why this approach doesn't meet your needs.
You may also consider looking into Joda Time. It has features that Java's core date/time classes lack.