Android Date Get getDateFromString(String dateStr, String pattern)

Here you can find the source of getDateFromString(String dateStr, String pattern)

Description

get Date From String

Declaration

public static Date getDateFromString(String dateStr, String pattern) 

Method Source Code

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static Date getDateFromString(String dateStr, String pattern) {
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        Date resDate = null;/*from  ww  w. j  a  va2  s  .  co  m*/
        try {
            resDate = sdf.parse(dateStr);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return resDate;
    }
}

Related

  1. getDate(String sDate, String dateFormat)
  2. getDate(int year, int month, int date, int hourOfDay, int minute, int second)
  3. getDateObj()
  4. getDateObj(String argsDate, String split)
  5. getDateObj(int year, int month, int day)
  6. getDateOffset(String date, int offset)