Reputation: 1330
How can I change the timezone, when I use this code to get the date?
Calendar c = Calendar.getInstance();
String date = org.apache.http.impl.cookie.DateUtils.formatDate(c.getTime());
This returns me the date in my timezone (GMT+00:00) but I need the CET time.
Upvotes: 0
Views: 46
Reputation: 8528
Use the setTimeZone
method on your calendar to set the time zone to CET.
c.setTimeZone( "Europe/Amsterdam" );
Upvotes: 1