I had tried to convert the given date Mon Jul 04 00:00:00 IST 2011 to GMT like this: 2011-07-04 18:10:47 GMT+00:00 2011 but it displays 3/7/11 6:30 PM
This is my code:
java.text.SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
java.text.SimpleDateFormat res_format = new SimpleDateFormat("dd/mm/yyyy HH:mm");
java.util.Date date1 = format.parse("2011-07-04 00:00:00");
DateFormat gmtFormat = new SimpleDateFormat();
TimeZone gmtTime = TimeZone.getTimeZone("GMT+00");
gmtFormat.setTimeZone(gmtTime);
System.out.println("Current Time: "+date1);
System.out.println("Time:"+gmtFormat.format(date1));
This works for me: