Java Date Parse convertXMLDate(String date)

Here you can find the source of convertXMLDate(String date)

Description

convert XML Date

License

Apache License

Declaration

static Date convertXMLDate(String date) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2003, 2006 svnClientAdapter project and others.
 *
 * 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./* w  ww  .j a va 2 s.  c om*/
 *
 * Contributors:
 *     svnClientAdapter project committers - initial API and implementation
 ******************************************************************************/

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    private static DateFormat xmlFormat = new SimpleDateFormat(
            "yyyy-MM-dd'T'HH:mm:ss");

    static Date convertXMLDate(String date) {
        if (date == null)
            return null;
        try {
            return xmlFormat.parse(date);
        } catch (ParseException e1) {
            return null;
        }
    }
}

Related

  1. convertTimeInMillisecondsToDate(long timeInMilliseconds)
  2. convertTimeStampToDate(String dateString, String srcFormat, String destFormat)
  3. convertTimestampToDateTime(Long timestamp, Boolean withSeconds)
  4. convertTimeZonesToDate(String fromTimeZone, String toTimeZone, DateTime fromDateTime)
  5. convertUTCDateToLocal(String sDate, TimeZone timezone)
  6. dateFromFilename(File file, Pattern fileNamePattern, DateFormat dateFormat)
  7. dateFromHourAndMinutes(final String pTime)
  8. dateFromISO8601(String iso)
  9. dateFromISO8601(String time)