Android Date Format String Create getDateByFormat(String strDate, String format)

Here you can find the source of getDateByFormat(String strDate, String format)

Description

get Date By Format

Declaration

public static Date getDateByFormat(String strDate, String format) 

Method Source Code

//package com.java2s;

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

import java.util.Date;

public class Main {

    public static Date getDateByFormat(String strDate, String format) {
        SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat(format);
        Date date = null;//from www . ja  v  a  2s  .  co m
        try {
            date = mSimpleDateFormat.parse(strDate);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return date;
    }
}

Related

  1. convertFormat(String src, String f1, String f2)
  2. dateFormatToString(int date, Context context)
  3. getGMTDateFormat()
  4. getSimpleDateFormat()
  5. getSimpleDateFormatter()
  6. getStringByFormat(String strDate, String format)
  7. getMySQLDateFormat()