Android Date String to Date Convert getDateFromString(String dateStr, String pattern)

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

Description

get Date From String

License

Apache License

Declaration

public static Date getDateFromString(String dateStr, String pattern) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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 w  ww  .  ja  va 2s  .  com*/
        try {
            resDate = sdf.parse(dateStr);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return resDate;
    }
}

Related

  1. parse2Date(SimpleDateFormat s, Object d)
  2. stringToDate(String src, String format)
  3. toDateFromLongFormat(String date)
  4. parse(String aFormat, String date)
  5. getDate(String date)
  6. getDateFromString(String string)
  7. getDateObj(String argsDate, String split)
  8. getDateOffset(String date, int offset)
  9. getDateTomorrow(String date)