Android Date Format fromString(String dateStr)

Here you can find the source of fromString(String dateStr)

Description

from String

License

Open Source License

Declaration

public static Date fromString(String dateStr)
            throws java.text.ParseException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;

import java.util.Date;
import java.util.Locale;

public class Main {
    public static final String DATE_FORMAT = "yyyy-MM-dd G HH:mm:ss z";

    public static Date fromString(String dateStr)
            throws java.text.ParseException {
        return fromString(dateStr, DATE_FORMAT);
    }/*from  ww w  . j av  a2s  .  c  o  m*/

    public static Date fromString(String dateStr, String dateFormat)
            throws java.text.ParseException {
        return fromString(dateStr, dateFormat, Locale.ENGLISH);
    }

    public static Date fromString(String dateStr, String dateFormat,
            Locale locale) throws java.text.ParseException {
        SimpleDateFormat format = new SimpleDateFormat(dateFormat, locale);
        return format.parse(dateStr);
    }
}

Related

  1. formatDate(String date)
  2. formatDate(long millis)
  3. formatDate1(String date)
  4. formatDateAndTime(long millis)
  5. formatTM(Date d)
  6. fromString(String dateStr, String dateFormat)
  7. fromString(String dateStr, String dateFormat, Locale locale)
  8. getBeforeYear()
  9. getCurrentDate()