Android Date String Parse toDate(String sdate)

Here you can find the source of toDate(String sdate)

Description

to Date

Declaration

public static Date toDate(String sdate) 

Method Source Code

//package com.java2s;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    private final static ThreadLocal<SimpleDateFormat> dateFormater = new ThreadLocal<SimpleDateFormat>() {
        @Override/*from w w  w  .j  a v a2s .c o m*/
        protected SimpleDateFormat initialValue() {
            return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        }
    };

    public static Date toDate(String sdate) {
        try {
            return dateFormater.get().parse(sdate);
        } catch (ParseException e) {
            return null;
        }
    }
}

Related

  1. parseSimpleDate(String dateString)
  2. parseUTCFormattedDateString(String dateString)
  3. parseYoutubeDate(String rawDate)
  4. stringToDate(String str)
  5. toDate(String sdate)
  6. toDateFormat(String d, String delim)
  7. parseDate(CharSequence input)
  8. parseDate(CharSequence input, Date defaultDate)
  9. parseDate(CharSequence input, String pattern, Date defaultDate)