Here you can find the source of parseISODateFormat(String dateStr)
public static String parseISODateFormat(String dateStr)
//package com.java2s; /*/* w w w. j a va 2 s . c o m*/ * Copyright 2010 JBoss Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { private static final SimpleDateFormat CREATION_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); private static final SimpleDateFormat LAST_MODIFIED_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); protected static final SimpleDateFormat GUNVOR_TOOLS_DATE_FORMAT = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss z", Locale.getDefault()); public static String parseISODateFormat(String dateStr) { if (dateStr == null) return null; String val = dateStr; try { if (dateStr.indexOf('T') == 10 && dateStr.endsWith("Z")) { Date date = CREATION_DATE_FORMAT.parse(dateStr); val = GUNVOR_TOOLS_DATE_FORMAT.format(date); } else if (dateStr.indexOf('T') == 10) { Date date = LAST_MODIFIED_DATE_FORMAT.parse(dateStr); val = GUNVOR_TOOLS_DATE_FORMAT.format(date); } } catch (ParseException e) { } return val; } }