Android Date String Parse getDateByTime(String time)

Here you can find the source of getDateByTime(String time)

Description

get Date By Time

Declaration

public static Date getDateByTime(String time) 

Method Source Code

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

import java.util.Date;

import android.text.TextUtils;

public class Main {
    public static Date getDateByTime(String time) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        Date date;//from  www  . j av a2 s. c o  m
        try {
            if (TextUtils.isEmpty(time)) {
                return null;
            }
            date = sdf.parse(time);
            return date;
        } catch (ParseException e) {
            e.printStackTrace();
            return null;
        }
    }
}

Related

  1. ISO8601ToTimestamp(String aDate)
  2. ParseStringToDate(String date)
  3. isDateString(String dirtyDate)
  4. isDateTimeString(String dirtyDateTime)
  5. parse(String date)
  6. parse(String date, String format)