Android Date String to Date Convert getDateFromString(String string)

Here you can find the source of getDateFromString(String string)

Description

get Date From String

Declaration

public static Date getDateFromString(String string) 

Method Source Code

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

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

import java.util.Date;

public class Main {
    public static Date getDateFromString(String string) {
        try {//w  ww.j  av a2  s. c  o m
            DateFormat m_ISO8601Local = new SimpleDateFormat(
                    "yyyy-MM-dd'T'HH:mm:ss");
            return m_ISO8601Local.parse(string);
        } catch (ParseException e) {
            return new Date(System.currentTimeMillis());
        }
    }
}

Related

  1. stringToDate(String src, String format)
  2. toDateFromLongFormat(String date)
  3. parse(String aFormat, String date)
  4. getDate(String date)
  5. getDateFromString(String dateStr, String pattern)
  6. getDateObj(String argsDate, String split)
  7. getDateOffset(String date, int offset)
  8. getDateTomorrow(String date)
  9. convertStandardDateTime(String time)