Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.support.annotation.NonNull;

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

public class Main {
    /**
     * Parse a {@link String} that contains a valid date with time zone.
     *
     * @param dateTime
     * @return
     */
    public static Date parseTimeZone(@NonNull String dateTime) {
        final SimpleDateFormat timeZoneParser = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
        Date parsed = null;

        try {
            parsed = timeZoneParser.parse(dateTime);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return parsed;
    }
}