Java Code Examples for com.google.api.client.util.DateTime#parseRfc3339()

The following examples show how to use com.google.api.client.util.DateTime#parseRfc3339() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Json.java    From java-asana with MIT License 5 votes vote down vote up
@Override
public DateTime deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) {
    DateTime result = null;
    try {
        String date = jsonElement.getAsString();
        result = DateTime.parseRfc3339(date);
    } catch (NumberFormatException e)  {
        System.err.println("Couldn't parse date: " + jsonElement.getAsString());
    }
    return result;
}
 
Example 2
Source File: PlurksLoadable.java    From android-oauth-client with Apache License 2.0 4 votes vote down vote up
public static DateTime getOffset(Bundle args) {
    return args == null || !args.containsKey(ARG_OFFSET) ? null :
            DateTime.parseRfc3339(args.getString(ARG_OFFSET));
}