Java Date Format ISO fromIso8601(@Nullable String date)

Here you can find the source of fromIso8601(@Nullable String date)

Description

Converts a ISO-8601 string to a Calendar -object.

License

Microsoft Public License

Parameter

Parameter Description
date the date in the form of a ISO-8601 string (for example: '2009-06-30T18:30:00+02:00')

Return

the calendar

Declaration

@Nullable
public static Calendar fromIso8601(@Nullable String date) 

Method Source Code

//package com.java2s;
/**************************************************************************
 * <pre>//from   www  .  j a  v  a  2 s .  c o  m
 *
 * Copyright (c) Unterrainer Informatik OG.
 * This source is subject to the Microsoft Public License.
 *
 * See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
 * All other rights reserved.
 *
 * (In other words you may copy, use, change and redistribute it without
 * any restrictions except for not suing me because it broke something.)
 *
 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
 * PURPOSE.
 *
 * </pre>
 ***************************************************************************/

import java.util.Calendar;

import javax.annotation.Nullable;

public class Main {
    /**
     * Converts a ISO-8601 string to a {@link Calendar}-object.
     *
     * @param date the date in the form of a ISO-8601 string (for example: '2009-06-30T18:30:00+02:00')
     * @return the calendar
     */
    @Nullable
    public static Calendar fromIso8601(@Nullable String date) {
        if (date == null) {
            return null;
        }
        return javax.xml.bind.DatatypeConverter.parseDateTime(date);
    }
}

Related

  1. formattedIso8601DateString(Calendar pCal)
  2. formatTimestampIso8601(long millis, TimeZone zone)
  3. formatToIso8601(Date d)
  4. formatToISO8601(Date date)
  5. formatWikiISO8601(Date d)
  6. fromIso8601(String iso)
  7. get_ISO_8601()
  8. getDateAsISOString(Date date)
  9. getFormattedMillisolString(double s)