I want this date to be displayed in GMT "01/01/2100"
Expecting result - "Fri Jan 01 00:00:00 GMT 2100"
Result i am seeing - "Thu Dec 31 19:00:00 EST 2099"
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
try{
Date myDate = sdf.parse("01/01/2100");
System.out.println(myDate);
}
catch(Exception e){
}
I want the result myDate in GMT time not EST
Example 2
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
sdf.setTimeZone(TimeZone.getTimeZone("gmt"));
try{
Date myDate = sdf.parse("2010-05-23 09:01:02");
SimpleDateFormat df = new SimpleDateFormat("EEE, d MMM yyyy, HH:mm");
System.out.println("MYDATE: " +df.format(myDate));
}
catch(Exception e){
}
Output: Sun, 23 May 2010, 05:01
Expecting: Sun, 23 May 2010, 09:01
http://goo.gl/uIy9RQ - URL for my project code, run and check the result