Java Parse Date parseDateString(TimeZone tz, String dateString)

Here you can find the source of parseDateString(TimeZone tz, String dateString)

Description

parse Date String

License

Apache License

Declaration

public static Date parseDateString(TimeZone tz, String dateString) 

Method Source Code

//package com.java2s;
// Licensed to the Apache Software Foundation (ASF) under one

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

import java.util.Date;
import java.util.TimeZone;

public class Main {
    public static Date parseDateString(TimeZone tz, String dateString) {
        return parseDateString(tz, dateString, "yyyy-MM-dd HH:mm:ss");
    }/*w  w  w. j  ava2  s. co  m*/

    public static Date parseDateString(TimeZone tz, String dateString,
            String formatString) {
        DateFormat df = new SimpleDateFormat(formatString);
        df.setTimeZone(tz);

        try {
            return df.parse(dateString);
        } catch (ParseException e) {
            throw new IllegalArgumentException(e);
        }
    }
}

Related

  1. parseDateStrFormat(String strDate)
  2. parseDateString(String dateStr)
  3. parseDateString(String dateString)
  4. parseDateString(String pattern, String dateString)
  5. parseDateString(String s)
  6. parseDateStringToDate(DateFormat format, String dateString)
  7. parseDateStrShort(String date)
  8. parseDateSubset(String value, String[] parsePatterns, Locale l, TimeZone tz)
  9. parseDateTime(@Nullable String s)