public static Date toDateFromLongFormat(String date) {
    if (date == null) {
      return null;
    }

    // Is this an all-digit date? Then assume it's the "seconds since epoch"
    // variant
    if (date.trim().matches("\\d+")) {
      return new Date(Long.parseLong(date) * 1000L);
    }

    Date parsedDate = toDateWithFormatString(date, FACEBOOK_LONG_DATE_FORMAT);

    // Fall back to variant without timezone if the initial parse fails
    if (parsedDate == null) {
      parsedDate = toDateWithFormatString(date, FACEBOOK_LONG_DATE_FORMAT_WITHOUT_TIMEZONE);
    }

    // Fall back to variant without seconds if secondary parse fails
    if (parsedDate == null) {
      parsedDate = toDateWithFormatString(date, FACEBOOK_LONG_DATE_FORMAT_WITHOUT_TIMEZONE_OR_SECONDS);
    }

    return parsedDate;
  }
public static Date toDateFromLongFormat ( String date ) { if ( date == null ) { return null ; } if ( date . trim ( ) . matches ( "\\d+" ) ) { return new Date ( Long . parseLong ( date ) * 1000L ) ; } Date parsedDate = toDateWithFormatString ( date , FACEBOOK_LONG_DATE_FORMAT ) ; if ( parsedDate == null ) { parsedDate = toDateWithFormatString ( date , FACEBOOK_LONG_DATE_FORMAT_WITHOUT_TIMEZONE ) ; } if ( parsedDate == null ) { parsedDate = toDateWithFormatString ( date , FACEBOOK_LONG_DATE_FORMAT_WITHOUT_TIMEZONE_OR_SECONDS ) ; } return parsedDate ; }
Returns a Java representation of a Facebook "long" {@code date} string, or the number of seconds since the epoch.
<p>
Supports dates with or without timezone information.

@param date
Facebook {@code date} string.
@return Java date representation of the given Facebook "long" {@code date} string or {@code null} if {@code date}
is {@code null} or invalid.