Java datetime format convert
date here my problem: String datetime = "2012-03-24 23:20:51"; I know that that string is in UTC timezone. I need to convert this string to format "yyy-mm-dd'T'HH:mm:ssZ". To do this I'm using following code: SimpleDateFormat inFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); inFormatter.setTimeZone(TimeZone.getTimeZone("UTC")); Date inDate = inFormatter.parse(datetime); SimpleDateFormat outFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); outFormatter.setTimeZone(TimeZone.getTimeZone("UTC")); String output = outFormatter.format(inDate); The problem is that this code is