In Java, I want to get the current time in GMT.
I tried various options like this:
Date date = new Date();
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
date1 = calendar.getTime();
But the date is always is interpreted in my local time zone.
What am I doing wrong and how can I convert a java Date to GMT?
Question&Answers:os