Android Date String Parse parseDateTime(String dateString)

Here you can find the source of parseDateTime(String dateString)

Description

parse Date Time, "E MMM d HH:mm:ss Z yyyy"

Declaration

public static final Date parseDateTime(String dateString) 

Method Source Code

//package com.java2s;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;
import java.util.Locale;
import android.util.Log;

public class Main {
    private static final String TAG = "DateTimeHelper";
    public static final DateFormat TWITTER_DATE_FORMATTER = new SimpleDateFormat(
            "E MMM d HH:mm:ss Z yyyy", Locale.US);

    public static final Date parseDateTime(String dateString) {
        try {/*from  ww  w.jav a  2 s .co  m*/
            Log.v(TAG, String.format("in parseDateTime, dateString=%s",
                    dateString));
            return TWITTER_DATE_FORMATTER.parse(dateString);
        } catch (ParseException e) {
            Log.w(TAG, "Could not parse Twitter date string: " + dateString);
            return null;
        }
    }
}

Related

  1. parseDate(String str, String... parsePatterns)
  2. parseDate(String ts)
  3. parseDate(final String dateValue, String[] dateFormats)
  4. parseDate(final String dateValue, String[] dateFormats)
  5. parseDateStrictly(String str, String... parsePatterns)
  6. parseDateWithLeniency(String str, String[] parsePatterns, boolean lenient)
  7. parseLongFormat(String dateString)
  8. parseSearchApiDateTime(String dateString)
  9. parseString(String dateStr)