Example usage for com.google.gson.internal.bind.util ISO8601Utils parse

List of usage examples for com.google.gson.internal.bind.util ISO8601Utils parse

Introduction

In this page you can find the example usage for com.google.gson.internal.bind.util ISO8601Utils parse.

Prototype

public static Date parse(String date, ParsePosition pos) throws ParseException 

Source Link

Document

Parse a date from ISO-8601 formatted string.

Usage

From source file:org.cgiar.ccafs.marlo.utils.DateTypeAdapter.java

License:Open Source License

private synchronized Date deserializeToDate(String json) {
    try {//  w w  w.j ava  2s  . c o  m
        return localFormat.parse(json);
    } catch (ParseException ignored) {
    }
    try {
        return enUsFormat.parse(json);
    } catch (ParseException ignored) {
    }
    try {
        return ISO8601Utils.parse(json, new ParsePosition(0));
    } catch (ParseException e) {
        return new Date();
    }
}