app/src/main/java/org/andstatus/app/net/social/Connection.java
/**
     * @return Unix time. Returns 0 in a case of an error
     */
@return Unix time. Returns 0 in a case of an error
@return Unix time . Returns 0 in a case of an error
public long parseDate(String stringDate) {
        if(StringUtil.isEmpty(stringDate)) {
            return 0;
        }
        long unixDate = 0;
        String[] formats = {"", "E MMM d HH:mm:ss Z yyyy", "E, d MMM yyyy HH:mm:ss Z"};
        for (String format : formats) {
            if (StringUtil.isEmpty(format)) {
                try {
                    unixDate = Date.parse(stringDate);
                } catch (IllegalArgumentException e) {
                    MyLog.ignored(this, e);
                }
            } else {
                DateFormat dateFormat1 = new SimpleDateFormat(format, Locale.ENGLISH);
                try {
                    unixDate = dateFormat1.parse(stringDate).getTime();
                } catch (ParseException e) {
                    MyLog.ignored(this, e);
                }
            }
            if (unixDate != 0) {
                break;
            }
        }
        if (unixDate == 0) {
            MyLog.d(this, "Failed to parse the date: '" + stringDate +"'");
        }
        return unixDate;
    }
public long parseDate ( String stringDate ) { if ( StringUtil . isEmpty ( stringDate ) ) { return 0 ; } long unixDate = 0 ; String [ ] formats = { "" , "E MMM d HH:mm:ss Z yyyy" , "E, d MMM yyyy HH:mm:ss Z" } ; for ( String format : formats ) { if ( StringUtil . isEmpty ( format ) ) { try { unixDate = Date . parse ( stringDate ) ; } catch ( IllegalArgumentException e ) { MyLog . ignored ( this , e ) ; } } else { DateFormat dateFormat1 = new SimpleDateFormat ( format , Locale . ENGLISH ) ; try { unixDate = dateFormat1 . parse ( stringDate ) . getTime ( ) ; } catch ( ParseException e ) { MyLog . ignored ( this , e ) ; } } if ( unixDate != 0 ) { break ; } } if ( unixDate == 0 ) { MyLog . d ( this , "Failed to parse the date: '" + stringDate + "'" ) ; } return unixDate ; }
@return Unix time.
@return Unix time .