Java Parse Date parseDate(String date, String pattern)

Here you can find the source of parseDate(String date, String pattern)

Description

parse Date

License

Apache License

Declaration

public static Date parseDate(String date, String pattern) 

Method Source Code

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

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class Main {

    public static Date parseDate(String date, String pattern) {
        SimpleDateFormat df = new SimpleDateFormat(pattern);
        df.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
        try {/*from w  ww  .j  a  va  2 s . c o m*/
            return df.parse(date);
        } catch (ParseException e) {
            throw new IllegalArgumentException(e);
        }
    }
}

Related

  1. parseDate(String date, String format)
  2. parseDate(String date, String format)
  3. parseDate(String date, String format)
  4. parseDate(String date, String format)
  5. parseDate(String date, String pattern)
  6. parseDate(String date, String pattern)
  7. parseDate(String date, String pattern, TimeZone zone)
  8. parseDate(String dateAsString)
  9. parseDate(String dateAsString)